{{indexmenu_n>100}} ====== Teaser: Clear areas if no content available ====== If there is not Content for the teaser available, you can use this snippet to kill entries in the header and footer of the template from CP before delivery. Like that the output of the CP-title or the container avoided if no content is present. In teaser template we have to insert additional tags. ===== Description: ===== - To identify this CP, it is important to place the entry ##%%%%## into the head area of the template, analogous to the entry in the script. - If there is no content available, all messages between ##%%%%## and ##%%%%## are removed. - Additionally you have to insert **%%%%** ##%%%%## **%%%%**. ##**%%%%**## serves as a simple mark to determine whether content is present or not. \\ // ----- Built-in tag // CP Identifier (New tag) // Delete range start (New tag)

{TITLE}

{SUBTITLE}
// Delete range ende (New tag) // ----- Built-in tag // ----- Built-in tag // If no content, it does not exist!!! (New tag) // ----- Built-in tag // ----- Built-in tag // Delete range start (New tag)
// Delete range ende (New tag) // ----- Built-in tag
\\ ---- Docu: -- \\ Forum: -- **Author:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS Version:** >= 1.4x \\ **Version:** V1.0 //(22.02.2010)// \\ **Condition:** -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_init'] = 1; ---- \\ ===== Example template: ===== File: **/template/inc_cntpart/teaser/my_template01.tmpl**

{TITLE}

{SUBTITLE}

{TITLE} »

[IMAGE]
{IMAGE}[CAPTION]

{CAPTION}

[/CAPTION]
[/IMAGE]
{DATE:d/m/y lang=EN}[SUBTITLE] {SUBTITLE}.[/SUBTITLE] {SUMMARY} »
[IMAGE] [/IMAGE]
\\ ===== PHP: ===== File: **/template/inc_script/frontend_init/cp_trig_teaser01.php** // ----- Eingebauter Tag * * // CP Identifizierer (Neuer Tag) * * // Loeschbereich Anfang (Neuer Tag) * *
*

{TITLE}

*
{SUBTITLE}
* * // Loeschbereich Ende (Neuer Tag) * * // ----- Eingebauter Tag * * * * // ----- Eingebauter Tag * * // Wenn kein Content, dann nicht vorhanden!!! (Neuer Tag) * * // ----- Eingebauter Tag * * * // ----- Eingebauter Tag * * // Loeschbereich Anfang (Neuer Tag) *
* // Loeschbereich Ende (Neuer Tag) * * // ----- Eingebauter Tag * * ***************************************************************************** */ function CP_TEASERX_01($text, & $data) { if( $data['acontent_type'] == 8 AND strpos($text, '') ) { if (strpos($text, '') == false) { $text = preg_replace('/(.*?)/ism', '', $text); // Head loeschen } // dumpVar($text); } return $text; } // ---- END function register_cp_trigger('CP_TEASERX_01'); ?>