Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>BTW: as pgampe said it can be of course done more universal with some checkbox or even dropdown when you select class name.</p> <p>This is a short tutorial for checkbox. For this tutorial I assume the extension name is "t3_local"</p> <p><strong>STEP 1</strong></p> <p>In ext_tables.sql file add:</p> <pre><code>CREATE TABLE pages ( tx_t3local_special tinyint(4) DEFAULT '0' NOT NULL, } </code></pre> <p>Then go into Extension Manager into your extension and update database to create the new field in pages table.</p> <p><strong>STEP 2</strong></p> <p>In ext_tables.php file add:</p> <pre><code>$tempColumns = Array( 'tx_t3local_special' =&gt; Array( 'exclude' =&gt; 1, 'label' =&gt; 'Some label for special', 'config' =&gt; Array( 'type' =&gt; 'check', 'default' =&gt; 0 ) ) ); t3lib_div::loadTCA('pages'); t3lib_extMgm::addTCAcolumns('pages', $tempColumns, 1); t3lib_extMgm::addToAllTCAtypes('pages', 'tx_t3local_special'); </code></pre> <p>It is ready now to use in the backend. After you clear the TYPO3 cache you should see the checkbox in page properties. Now we must only use it to build our menu in frontend.</p> <p><strong>STEP 3</strong></p> <p>Now it all depends what do you want to do with this switch. Assuming that you want to add a class for <strong>li</strong> here is a little trick how to allow to use several such switches to accumulate different classes.</p> <pre><code>NO.wrapItemAndSub.stdWrap { prepend.cObject = LOAD_REGISTER prepend.cObject { special1class.cObject = TEXT special1class.cObject { value = special1-class if.isTrue.field = tx_t3local_special } special2class.cObject = TEXT special2class.cObject { value = special2-class if.isTrue.field = tx_t3local_special2 } } append = TEXT append.value = &lt;li class="clearfix {register:special1class} {register:special2class}"&gt;/li&gt; append.insertData = 1 } </code></pre> <p><strong>NOTE</strong></p> <p>As you now know how to add switches to page property you can also use them to turn off/on some functionality on page. For example I use such switch to turn on/off breadcrumbs for page. In this example the if checkbox is checked the breadcrumb of off.</p> <p>For this working you must remember to add the field name to typo3conf/localconf.php file (or LocalConfiguration.php in 6.x) </p> <pre><code>$TYPO3_CONF_VARS['FE']['addRootLineFields'] .= ',tx_t3local_breadcrumb'; </code></pre> <p>And the TS:</p> <pre><code>lib.breadcrumb = COA lib.breadcrumb.stdWrap.if.isFalse.data = page:tx_t3local_breadcrumb lib.breadcrumb { ... ... ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload