WWW.GAMEREACTION.NL

"Stop poking me!" - Peon
You are here: gamereaction.nl  > Blog  > Typoscript stdWrap 

Typoscript stdWrap

posted on 6 March 2009 in TYPO3

stdWrap is a TYPO3 function for altering or replacing output to the frontend of your site. It is a very complex system and can take a long time to master, I will just list a few things which I know in hopes that they will aid other beginners.

########################################################
##### Hello World example:
########################################################
10 = TEXT
10 {
    value = hello world
    value.case = upper
    wrap = <b>|</b>
}

In the above example we set the value of our text element to hello world, then we do something extra, we use standard wrap to place bold markers around it. As you can see, the value of our text is wrapped by placing it into the wrap string at the '|' marker. Thus, setting wrap is one way to use the function stdWrap on our data. We are also using the value.case to produce uppercase output.

########################################################
##### $cObj->data Field Import example:
########################################################
20 = TEXT
20.value = hello world
20.field = title

In the above example we are pulling data out of the field 'title' from $cObj->data if you wish to see what data is available to you through the $cObj->data first ensure you are set to receive debug information and then simply add the following property to your typoscript:
page.10 = TEXT
page.10.debugData = 1

########################################################
##### Importing data from a database table example:
########################################################
30 = CONTENT
30 {
    table = tt_content
    wrap = <ul>|</ul>
    select{
        pidInList = 11
    }
    renderObj = TEXT
    renderObj.field = bodytext
    renderObj.wrap = <li>|</li>
}

In this example I have selected content from the "bodytext" field in tt_content where the pid of the element is 11 and then outputted it in an unordered list.

As you can see stdWrap is a very powerful tool in the TYPO3 developers toolkit, I am just starting to come to grips with it but hope I can post a bit more on this in the near future.

No comments have been posted





are you human?

this site was made by gamereaction
powered by TYPO3
RSS Feed