NAVIGATION
This shows you the differences between two versions of the page.
english:phpwcms-system:admin:template:conditional_replacers [2015/02/08 16:48] Claus |
english:phpwcms-system:admin:template:conditional_replacers [2018/06/03 18:09] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Conditional Replacers ====== | ====== Conditional Replacers ====== | ||
+ | **Autor:** Claus Szypura (update) http://phoenixmedia.de //2015/02/10 // \\ | ||
+ | |||
This makes it possible to show or hide code in dependance of having content or not. If no content no code is generated\\ | This makes it possible to show or hide code in dependance of having content or not. If no content no code is generated\\ | ||
//This way our source code remains clean an will not be "polluted" by any empty and unneccessary stuff.// | //This way our source code remains clean an will not be "polluted" by any empty and unneccessary stuff.// | ||
+ | ===== The Principle ===== | ||
+ | |||
+ | to make it happen, there are some BasicWrapper | ||
+ | An example by Oliver: [[http://forum.phpwcms.org/viewtopic.php?f=16&t=24605&start=15|Forum]]\\ | ||
+ | <code html> | ||
+ | |||
+ | <header> | ||
+ | <nav>{NAV_LIST_UL:BP}</nav> | ||
+ | [HEADER] | ||
+ | <section class="header-content">{HEADER}</section> | ||
+ | [/HEADER] | ||
+ | </header> | ||
+ | <div class"main[LEFT] has-marginal-left[/LEFT][RIGHT] has-marginal-right[/RIGHT]"> | ||
+ | [LEFT] | ||
+ | <section class="col-left">{LEFT}</section> | ||
+ | [/LEFT] | ||
+ | <article> | ||
+ | {CONTENT} | ||
+ | </article> | ||
+ | [RIGHT] | ||
+ | <section class="col-left">{RIGHT}</section> | ||
+ | [/RIGHT] | ||
+ | </div> | ||
+ | <footer> | ||
+ | <p>© 2015 Whatever</p> | ||
+ | [FOOTER] | ||
+ | <section class="footer-content">{FOOTER}</section> | ||
+ | [/FOOTER] | ||
+ | </footer> | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ===== This also counts for CUSTOM_BLOCKS ===== | ||
+ | |||
+ | simple | ||
+ | <code html> | ||
+ | [BLOCK]<tag>{BLOCK}</tag>[/BLOCK] | ||
+ | [BLOCK_ELSE]<tag>och nö, fehlt</tag>[/BLOCK_ELSE] | ||
+ | </code> | ||
+ | |||
+ | nested | ||
+ | <code html> | ||
+ | [BLOCK_ELSE][RIGHT]<tag>{RIGHT}</tag>[/RIGHT][/BLOCK_ELSE] | ||
+ | </code> | ||
+ | |||
+ | ===== Want some examples? ===== | ||
+ | ==== LEFT visible? ==== | ||
+ | |||
+ | really? Here is the first, very simple (corrected by Oliver ;) )\\ | ||
+ | <code html> | ||
+ | [LEFT] | ||
+ | <div class="col-md-3"> | ||
+ | {LEFT} | ||
+ | </div> | ||
+ | [/LEFT ] | ||
+ | <div class="col-md-[LEFT]9[/LEFT][LEFT_ELSE]12[/LEFT_ELSE]"> | ||
+ | {CONTENT} | ||
+ | </div> | ||
+ | </code> | ||
+ | What does it do? Right what it should: in case {LEFT} has no content the main content will expand to 12 columns. Otherwise there is a column 3 and column 9 (bootstrap) | ||
+ | |||
+ | |||
+ | |||
+ | ==== LEVEL1_ID visible? ==== | ||
+ | by Oliver [[forum.phpwcms.org/viewtopic.php?f=16&t=24638|Forum]] | ||
+ | <code html> | ||
+ | [LEFT] | ||
+ | <div class="col-md-3"> | ||
+ | [LEVEL1_ID]{NAV_LIST_UL: F, {LEVEL1_ID} , , act_path , active } [/LEVEL1_ID] | ||
+ | {LEFT} | ||
+ | </div> | ||
+ | [/LEFT ] | ||
+ | <div class="col-md-[LEFT]9[/LEFT][LEFT_ELSE]12[/LEFT_ELSE]"> | ||
+ | {CONTENT} | ||
+ | </div> | ||
+ | </code> | ||
+ | |||
+ | ==== Level there? ==== | ||
+ | <code> | ||
+ | [IF_CAT:28,29,30]<!-- whatever -->[/IF_CAT] | ||
+ | [IF_NOTCAT:0,1,2]<!-- whatever -->[/IF_NOTCAT] | ||
+ | </code> |