NAVIGATION
Siehe auch: Templates/Vorlagen
Systemvariablen:
- $block['name'] // Name: [Vorlagenname] - $block['layout'] // Layout: [Layout-Nr.] - $block['overwrite'] // Einstellungen: [Standard|Name der PHP-Datei in /template/inc_settings/template_default/] - $block["css"] // CSS Datei: Ausgabe im array z.B. Array([0] => frontend.css [1] => nav_horiz_drop_down.css) - $block["htmlhead"] // Inhalt HTML Kopf: <head> - $block['jslib'] // JS Bibliothek: [Bibliothekname] - $block['jslibload'] // immer laden [0|1] - $block['googleapi'] // Google Ajax Lib benutzen [0|1] - $block['frontendjs'] // frontend.js laden (mehr aus historischen Gründen) [0|1] - $block['jsonload'] // JS onload: [JS String] - $block['feloginurl'] // FE LoginURL: [URL] - $block['headertext'] // Inhalt Kopfzeile: [Inhalt] - $block['maintext'] // Inhalt Haupt: [Inhalt] - $block['footertext'] // Inhalt Fußzeile: [Inhalt] - $block['lefttext'] // Inhalt links: [Inhalt] - $block['righttext'] // Inhalt rechts: [Inhalt] - $block['customblock_XXX'] // Inhalt Eigene Blöcke XXX [Inhalt] - $block['errortext'] // Inhalt Fehler: [Inhalt]
Eine Möglichkeit, eine Datei auf dem Server als Vorlage zu verwenden. So wird das Editieren der Vorlage aus dem CMS in einen FTP fähigen Editor verlagert.
Bedingung: → /config/phpwcms/conf.inc.php
In dem Verzeichnis template/inc_script/frontend_init/ wird die Datei template_inject01.php mit folgendem Inhalt abgelegt:
<?php /********************************************************************************************* * Backend Template main replace * Replaces the the main template with the contents of the * file "template/inc_script/template/main01.php". * KH 07.01.2010 **********************************************************************************************/ // ------------------------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ------------------------------------------------------------------------------------------- if ($block['maintext'] == 'main01.php') $block['maintext'] = file_get_contents(PHPWCMS_TEMPLATE.'/inc_script/template/'.$block['maintext']); ?>
Die Vorlagendatei heißt in diesem Beispiel main01.php und ist in template/inc_script/template/ abgelegt.
Das Script schaut im Vorlagenblock “Haupt:” nach ob dort der Text main01.php eingetragen ist. (Und nur dieser).
In main01.php wird der Quelltext für “Haupt:” abgelegt ohne den öffnenden/schließenden PHP-Tag <?php .... ?>.
Dieses Verfahren sollte nur in der Entwicklungsphase eingesetzt werden!!
Normalerweise sind diese Felder nicht mehr brauchbar, da diese bei der Layoutvariante Block: “Eigene” nicht abgefragt werden.
Mit einem kleinen Ersetzer ist es jedoch möglich diese Eingabefelder im Feld “Haupt” einzubinden.
An den Stellen an denen der Inhalt dieser Felder in das Template eingebunden werden soll, werden Tags in “Haupt:” gesetzt.
Bedingung: → /config/phpwcms/conf.inc.php
In dem Verzeichnis template/inc_script/frontend_init/ wird die Datei template_inject02.php mit folgendem Inhalt abgelegt:
<?php /********************************************************************************************* * Backend Template field replacer * Replaces the placeholder {HEADERTEMP}, {FOOTERTEMP}, {LEFTTEMP}, {RIGHTTEMP} in "main" * with the contents of the fields "header", "footer", "left", "right". * KH 07.01.2010 **********************************************************************************************/ // ------------------------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ------------------------------------------------------------------------------------------- if (!empty($block['headertext']) ) $block['maintext'] = str_replace('{HEADERTEMP}', $block['headertext'],$block['maintext']); if (!empty($block['righttext'])) $block['maintext'] = str_replace('{RIGHTTEMP}' , $block['righttext'], $block['maintext']); if (!empty($block['footertext'])) $block['maintext'] = str_replace('{FOOTERTEMP}', $block['footertext'],$block['maintext']); if (!empty($block['lefttext'])) $block['maintext'] = str_replace('{LEFTTEMP}' , $block['lefttext'], $block['maintext']); ?>
Die selbstdefinierten “Custom”-Blöcke werden mit (z.B. mit Blockname “BOX01” in Seitenlayout → Blöcke → Eigene:)
$block['customblock_BOX01']
angesprochen.
Beide Verfahren können auch kombiniert werden.