• Home
  • Services
  • Extensions
    • OAuth2 Server + Client
    • Cardealer
    • Questionaire
    • Sitepackage
  • Blog
  • Kontakt

TypoScript for ajax request which provides JSON of multiple colPos

10/23/2022 Frontend Vue

ajax_content = PAGE
ajax_content {
    typeNum = 123
config {
        disableAllHeaderCode = 1
additionalHeaders = Content-Type: application/json
additionalHeaders.10.header = Content-Type: application/json
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}

    1 = COA
1 {
        wrap = [|]
10 = CONTENT
10 {
            table = tt_content
select {
                pidInList = this
where = colPos = 0
orderBy = sorting
}
            renderObj = < tt_content
            slide = 0
slide {
                collect = 0
collectReverse = 0
collectFuzzy = 0
}

            #stdWrap.trim = 1
stdWrap.wrap = {"colPos0":"|"},
stdWrap.replacement {
                1 {
                    // remove line breaks
search = #\n#
replace =
                    useRegExp = 1
}
                2 {
                    // set a \ backslash before every " double quote
search = #"#
replace = \"
useRegExp = 1
}
            }
        }

        20 < .10
        20 {
            select {
                where = colPos = 1
}
            slide = 0
stdWrap.wrap = {"colPos1":"|"}
}
    }
}
Back