[TYPO3-english] [Typoscript question]: How to add the page uid to the body tag?

Ron Hall ronslists at busynoggin.com
Wed Jun 9 23:47:39 CEST 2010


Hello All,

Actually the body tags in framework are mapped in TV but it is still possible to add a class to it with TS. Here is code I have used before to do that.

[globalVar=TSFE:page|layout=1]
page.bodyTagAdd = class="withFeature"
[global]

In this case I am using the layout field in the page properties to conditionally add the class.

If you just want to add the class without a condition as Daniel originally wanted, it would be:

page.bodyTagAdd = class="class="pg12"

That way you do not have to touch any of the mapping in the templates. You can do it as Andy suggested but using the method I describe you do not have adjust it if you later change to a different template (having a different id)

Hope that helps. Remember, with TS virtually all things are possible. :)

Thanks,
Ron Hall

Busy Noggin, Inc.
a web development agency

www.busynoggin.com
templavoila.busynoggin.com

Twitter: busynoggin (general web tweets)
Twitter: typo3ron (for TYPO3 specific tweets)









On Jun 9, 2010, at 10:15 AM, Christopher Torgalson wrote:

> Hi,
> 
> On Wed, Jun 9, 2010 at 8:05 AM, Daniel Doesburg | Doesburg.biz
> <daniel at typo3-nl.eu> wrote:
>> Hi Stephen and Karl,
>> 
>> I think I was not clear enough.
>> 
>> I use the TV framework of Ron Hall. The html-source has already a body tag
>> in this form:
>> 
>> <body id="f1a">
>> 
>> Now I want to ADD a dynamic id or class
>> 
>> P.E. <body id="f1a" class="pg12">
>> 
>> The type of the TV-template and the uid of the page.
> 
> 
> Hopefully the body tag is generated by TS and not mapped in from the
> template. If it's mapped in from the template, you're going to need to
> change how it's mapped and then define it in TS, but if it's already
> TS, use the TS Object Browser in the Template module in the BE to
> change how it's done. If you need specific help with that, you're
> going to have to post the TS you find to this thread (I don't think
> that TV framework is especially widely used).
> 
> 
> -- 
> Christopher Torgalson
> http://www.typo3apprentice.com/
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> 



More information about the TYPO3-english mailing list