[TYPO3] Using subtitle in template

JoH asenau info at cybercraft.de
Mon Oct 16 17:06:00 CEST 2006


>>>> I want to use the pages subtitle as a text in my template. I use
>>>> this typoscript:
>>>>
>>>> # subtitle
>>>> lib.sub = TEXT
>>>> lib.sub {
>>>> value = domain.com
>>>> value.override.field = subtitle
>>>> value.wrap = domain.com: |
>>>> }
>>>>
>>>> And have tried many variations on this one, but none of them show
>>>> any result. What am I doing wrong?
>>> You are trying to get subtitle from tt_content but you need pages
>>> table. So try:
>>> value.override.data = page:subtitle
>>
>> "value" doesn't offer stdWrap properties in TEXT elements.
>> So this is the correct syntax:
>>
>> lib.sub = TEXT
>> lib.sub {
>>     value = domain.com
>>     override.field = subtitle
>>     override.wrap = domain.com: |
>> }
>>
>>
>> but then you might run into problems since the wrap will make the
>> override always happen even if the field subtitle is empty so I
>> guess it would be better to do it like this:
>>
>> lib.sub = COA
>> lib.sub {
>>     wrap = domain.com|
>>     10 = TEXT
>>     10.dataWrap = : {field:subtitle}
>>     10.fieldRequired = subtitle
>> }
>
> I tried both codes, but they both only render the wrap, without the
> subtitle. Could there be something else I'm doing wrong??

It seems you are not in the correct "scope" to get the field "subtitle".
It is a field of the pages table. So I assumed you are rendering this field
while rendering other stuff of the pages data array.
If you try do get the subtitle field while rendering elements from other
tables (like i.e. tt_content) you have to do it like Dmitry already
mentioned:

10.dataWrap = : {page:subtitle}

Should be working then.

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com





More information about the TYPO3-english mailing list