Vorlagen

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]


Einbinden einer statischen Datei als Vorlage in "Haupt:"

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

  • $phpwcms['allow_ext_init'] = 1;


In dem Verzeichnis template/inc_script/frontend_init/ wird die Datei template_inject01.php mit folgendem Inhalt abgelegt:

template_inject01.php

<?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 .... ?>.

<note important> Um die Abfrage schnell zu halten wird nicht gegen ein Vorhandensein der Vorlagendatei geprüft.

Dieses Verfahren sollte nur in der Entwicklungsphase eingesetzt werden!! </note>



Einbinden der Felder "Kopfzeile:", "Fußzeile:", "links:", "rechts:" in "Haupt:"

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.

  • {HEADERTEMP} = Inhalt aus “Kopfzeile:”
  • {FOOTERTEMP} = Inhalt aus “Fußzeile:”
  • {RIGHTTEMP} = Inhalt aus “rechts:”
  • {LEFTTEMP} = Inhalt aus “links:”

<note> Es kann u.U. passieren, dass einige Funktionen in den alternativen Felder vor dem Einfügen in “Haupt:” von System abgearbeitet werden, dann müssen diese Anweisungen Direkt in “Haupt:” platziert werden. Alternativ könnte der RT {SHOW_CONTENT:…..} verwendet werden. </note>

Bedingung:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_init'] = 1;


In dem Verzeichnis template/inc_script/frontend_init/ wird die Datei template_inject02.php mit folgendem Inhalt abgelegt:

template_inject02.php

<?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.

<note important> Um die Abfrage schnell zu halten wird nicht gegen ein Vorhandensein der Tags im “Haupt:” geprüft. Daher liegt es in Ihrer Verantwortung hier nur Tags zu setzen, wenn auch entsprechender Content in den alternativen Feldern vorhanden ist. </note>


Beide Verfahren können auch kombiniert werden.

deutsch/technik/systemvariablen/vorlagen.txt · Last modified: 2018/06/03 18:08 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0