[TYPO3-english] Accessing Object Data

John Fox fox at johnfoxstudios.com
Fri Dec 12 22:46:48 CET 2008


Dmitry,

Thank you for the thorough explanation.  I’ve been having trouble from
day-one with understanding that Typo3 is a configuration language and not an
object oriented programming language.  I still have a ways to go to fully
understand the Typo3 concept, but this was a great help.

Thanks so much for the optimized code too!

John


On 12/12/08 4:14 PM, "Dmitry Dulepov" <dmitry at typo3.org> wrote:

Hi! John Fox wrote: > I¹m still learning Typo3 and must be thinking about
this wrong.  I¹m > thinking that the TEXT (video.10.conf.tx_dam.10) object
is now populated > with my keywords and that I should be able to access that
data.  Any > help/direction would be greatly appreciated. It is not
populated, that's the problem. TypoScript is not a programming language, it
is a configuration language. So "video.10.conf.tx_dam.10" will always
contain a string "COA", nothing else. If you want to have the value of the
object identified by "video.10.conf.tx_dam.10", you need to force its
~processing~. The simplest way to do it is to use stdWrap. For example: 10 =
CONTENT 10 {    table = tt_news    renderObj = TEXT    renderObj.field =
title    select.andWhere {        cObject < video.10.conf.tx_dam        wrap
= keywords LIKE '|'    } } Here select.andWhere is of stdWrap type. It means
that it will be processed to produce some value. This TS tells that cObject
must be a copy of your TS object. cObject causes processing of your object
when andWhere is processed but before andWhere produces the final result.
Next the result of the cObject processing is wrapped to create normal SQL
statement ('wrap = ...'). The TS above is just for the idea. It is never
good to use result of one query in another query (not safe from security
point of view). By the way, small optimnization hint for your code: >
video.10 = RECORDS > video.10.source = TEXT > video.10.source.data = 9 More
simple: video.10.source = 9 > video.10.tables = tx_dam You can get rid of
the above if you use: video.10.source = tx_dam_9 > video.10.conf.tx_dam =
COA Why the COA? You have only one object inside. You do not need a COA. It
only increases processing time and eats memory. Just use:
video.10.conf.tx_dam = TEXT and so on. > video.10.conf.tx_dam { >     10 =
TEXT >     10 { >         field = keywords >         wrap = | There is no
need for this wrap because it does not wrap anything. So optimized TS is:
video.10 = RECORDS video.10.source = tx_dam_9 video.10.conf.tx_dam = TEXT
video.10.conf.tx_dam.field = keywords Smaller and more effective. -- Dmitry
Dulepov TYPO3 core team In the blog:
http://typo3bloke.net/post-details/how_will_i_fix_bugs_in_extensions_from_no
w_on/ My TYPO3 book:
http://www.packtpub.com/typo3-extension-development/book
_______________________________________________ TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list