[TYPO3-content-rendering] custom id and class per content

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Feb 8 10:54:24 CET 2007


stefano cecere wrote: on 30.01.2007 22:59:
> ben van 't ende [netcreators] wrote:
>> stefano cecere wrote:
>>> sorry for the silly question...
>>> but is it possible to easily define ad id and/or class for each content?
>>>
>>> just a string input field on each content where to enter id/class
>>>
>>> or doesn't it worth it?

>> Yes! How about this? You can add a id to your page and to your content
>> elements.
>>
>> (...)

> well yes i know i can tweak with TS and configure them..
> but this solution isn't very "portable"..
> 
> say that a designer/editor of mine wants to experiment with new CSS (he
> has accesse to the external css file)
> then wants to give to a content a special class, or id...
> 
> yes i can pre-define classes and put the in the frame selector.. but
> hasn't the same flexibility!
> 
> very strange.. i didn't find any extension to give free id/class per
> content!


I think this is not very difficult to create. Use kickstarter, just add
two new fields (input text) in tt_content and pages (page_cssid,
page_cssclass, content_cssid, content_cssclass) and you are done. You
can then use this in your TS-template as you use any other field from
those two tables:

tt_content.stdWrap.dataWrap = <div id="c{field:content_cssid}"
class="c{field:content_cssclass}"> | </div>

Some more bizarre TS with .if and stuff can be created to get rid of
those elements if there is nothing in it, but you can try that on your
own. Post your results here afterwards.

Cheers,
Ernesto


More information about the TYPO3-project-content-rendering mailing list