Bookmark and Share

TYPO3: Howto have a field for different CSS class for each content



If you want to specify a CSS class for each TYPO3 content (example: TEXT with IMAGE),

you can add a new filed "Class" that will allow you to set the CSS class.

Instructions:

Add the following lines to your typoscript (setup)

#[globalVar = TSFE:field|tx_modulis_ttcontent_class > 0]
tt_content.stdWrap.dataWrap =  <a name="{field:uid}"></a><div class="{field:tx_modulis_ttcontent_class}">|</div>
#[global]

You can uncomment first and last line to make sure that the CSS class will only be outputed if non empty.

Add the following Database column to the table tt_content:

It can be done with phpmyadmin or the kickstarter.

tx_modulis_ttcontent_class (type tinytext)

Add the following to file typo3conf/ext_tables.php:

$tempColumns = Array ( "tx_modulis_ttcontent_class" => Array ( "exclude" => 1, "label" => "Class", "config" => Array ( "type" => "input", "size" => "30", "default" => "tt_content", ) ), ); t3lib_div::loadTCA("tt_content"); t3lib_extMgm::addTCAcolumns("tt_content",$tempColumns,1); t3lib_extMgm::addToAllTCAtypes("tt_content","tx_modulis_ttcontent_class;;;;1-1-1");
Clear all caches and you're done !

One Response to “TYPO3: Howto have a field for different CSS class for each content”

  1. ovafynas Says:

    ovafynas…

    ls preteen magazines

Leave a Reply

You must be logged in to post a comment.