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

Ron Hall ronslists at busynoggin.com
Thu Jun 10 01:34:23 CEST 2010


Daniel,

If you are trying to use the uid as part of the class than the solution I gave earlier of using bodyTagAdd will not work because it has to take a string and does not have stdWrap properties.

But I wonder if you need to add this to the body tag. You could just write a TEXt object to open a div tag just inside the body tag using stdWrap to put the page uid in either a CSS id or class. You would then close that div just before the closing body tag. Using the framework you would write these items in the preCodeHeader and postCodeFooter libraries.

You would end up with an HTML structure like this.

<body id=f1a>
    <div id="pg_21">
...all the page content
   </div>
</body>

You end up with one extra div in the markup but you can use it to target your CSS and JavaScript and you can easily the page uid in that id.

Thanks,
Ron







On Jun 9, 2010, at 5:55 PM, Daniel Doesburg | Doesburg.biz wrote:

> Hi Ries,
> 
> Yes this part of typoscript is known.
> 
> But now I'm looking for a way to add, as id or class, the "name" of the TV template.
> 
> The templates are called f1a to f3d.
> So the body tag should look like:
> 
> The template is the f2c and the page uid is 21.
> 
> <body id="f2c" class="pg_21">
> 
> 
> Kind regards,
> 
> Daniel Doesburg
> 
> 
> 
> 
> 
> 
> Op 10-6-2010 0:43, Ries van Twisk schreef:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Jun 9, 2010, at 5:27 PM, Daniel Doesburg | Doesburg.biz wrote:
>> 
>>> Hi Ron,
>>> 
>>> Thanks for this answer. Its not exactly what I'm looking for.
>>> 
>>> I know this method to add a string to the body tag.
>>> 
>>> And so "page.bodyTagAdd = class="class="pg12" is not the problem.
>>> 
>>> But if the page has an uid of 12 than and only than is this correct.
>>> 
>>> But I'm looking for a way to get something like this:
>>> 
>>> page.bodyTagAdd = class="class="pg_{substitute page:id}"
>>> 
>>> And therfor the solutions in the other answers where more or less
>>> correct. But in that case I loose the "f1a"-part.
>>> 
>>> 
>>> Kind regards,
>>> 
>>> Daniel Doesburg
>>> 
>> 
>> 
>> Daniel,
>> 
>> are you looking for something like this?
>> You basicly need a cObject/stdWrap to do what you want to do,
>> bodyTagAdd is just a string...
>> 
>> page.bodyTag >
>> page.bodyTagCObject = HTML
>> page.bodyTagCObject.value.field = uid
>> page.bodyTagCObject.value.wrap = <body class="pg_|">
>> 
>> See :
>> http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.1/view/1/6/#id2515978
>> 
>> 
>> Ries
>> 
>> -------------------------------------------------------------------------------------------------
>> 
>> tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS
>> WebORB PostgreSQL DB-Architect
>> email: ries at vantwisk.nl web: http://www.rvantwisk.nl/ skype:
>> callto://r.vantwisk
>> Phone: +1 (803) 426-3350
>> 
>> 
> 
> _______________________________________________
> 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