NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:technik:systemvariablen [2010/03/14 09:54] Knut Heermann (flip-flop) |
deutsch:technik:systemvariablen [2018/06/03 18:08] (current) |
||
|---|---|---|---|
| Line 13: | Line 13: | ||
| 2 = z.B. wenn 1 dann Print | 2 = z.B. wenn 1 dann Print | ||
| 3 = wenn 1 dann zeig(e/t) Kategorie | 3 = wenn 1 dann zeig(e/t) Kategorie | ||
| - | 4 = wenn 1 dann Link zu Artikel | + | 4 = wenn 1 dann Modus Artikel-Detail |
| 5 = freie Nutzung | 5 = freie Nutzung | ||
| Line 25: | Line 25: | ||
| $aktion[2] = isset($aktion[2]) ? intval($aktion[2]) : 0; // z.B. wenn 1 dann Print | $aktion[2] = isset($aktion[2]) ? intval($aktion[2]) : 0; // z.B. wenn 1 dann Print | ||
| $aktion[3] = isset($aktion[3]) ? intval($aktion[3]) : 1; // wenn 1 dann zeige cat | $aktion[3] = isset($aktion[3]) ? intval($aktion[3]) : 1; // wenn 1 dann zeige cat | ||
| - | $aktion[4] = isset($aktion[4]) ? intval($aktion[4]) : 0; // wenn Link zu article zeige (1) | + | $aktion[4] = isset($aktion[4]) ? intval($aktion[4]) : 0; // Modus article detail (1) sonst article list (0) |
| $aktion[5] = isset($aktion[5]) ? intval($aktion[5]) : 0; // freie Nutzung | $aktion[5] = isset($aktion[5]) ? intval($aktion[5]) : 0; // freie Nutzung | ||
| </code> | </code> | ||
| Line 38: | Line 38: | ||
| \\ | \\ | ||
| **Die Artikel ID** //(Ausgabe nur im Artikeldetail)//: | **Die Artikel ID** //(Ausgabe nur im Artikeldetail)//: | ||
| - | <code php>echo 'Cat-ID: '.$GLOBALS['aktion']['1'];</code> | + | <code php>echo 'Article-ID: '.$GLOBALS['aktion']['1'];</code> |
| \\ | \\ | ||
| Befinden wir uns in der Kategorieansicht? [1=Ja|0=Nein] \\ | Befinden wir uns in der Kategorieansicht? [1=Ja|0=Nein] \\ | ||
| - | <code php>echo 'Cat-ID: '.$GLOBALS['aktion']['3'];</code> | + | <code php>echo 'CatShow: '.$GLOBALS['aktion']['3'];</code> |
| \\ | \\ | ||
| Befinden wir uns im Artikeldetail? [1=Ja|0=Nein]: \\ | Befinden wir uns im Artikeldetail? [1=Ja|0=Nein]: \\ | ||
| - | <code php>echo 'Cat-ID: '.$GLOBALS['aktion']['4'];</code> | + | <code php>echo 'Detail: '.$GLOBALS['aktion']['4'];</code> |
| \\ | \\ | ||
| **Annahme:** Eine Kategorie //(ID=7)// arbeitet im einfachen Artikelmodus //(ID=26)// //(Anzahl an Top-Artikeln: -1, oder wenn Anzahl an Top-Artikeln: > 1 und Artikelanzahl = 1)// \\ | **Annahme:** Eine Kategorie //(ID=7)// arbeitet im einfachen Artikelmodus //(ID=26)// //(Anzahl an Top-Artikeln: -1, oder wenn Anzahl an Top-Artikeln: > 1 und Artikelanzahl = 1)// \\ | ||
| Line 55: | Line 55: | ||
| [5] => 0 | [5] => 0 | ||
| </code> | </code> | ||
| - | Als Link: ''%%index.php?id=7,26,0,1,1,0%%'' | + | Als Link: ''%%index.php?id=7,26,0,1,1,0%%'' oder der direkte Artikellink: ''%%index.php?aid=26%%'' |
| \\ | \\ | ||
| Line 77: | Line 77: | ||
| [4] => 1 // Artikel-Detailansicht | [4] => 1 // Artikel-Detailansicht | ||
| [5] => 0 | [5] => 0 | ||
| - | </code> | + | </code>Als Link: ''%%index.php?id=2,6,0,0,1,0%%'' oder der direkte Artikellink: ''%%index.php?aid=6%%'' |
| - | Als Link: ''%%index.php?id=2,6,0,0,1,0%%'' | + | |
| \\ | \\ | ||
| Line 84: | Line 83: | ||
| ---- | ---- | ||
| ---- | ---- | ||
| + | \\ | ||
| + | ===== Artikeldaten (Datum): ===== | ||
| + | |||
| + | Alle Datumsangaben in einem Artikel direkt aus den Variablen generiert: | ||
| + | |||
| + | Im Template für den **Artikel-Detailmodus**: | ||
| + | <code php> | ||
| + | [PHP] | ||
| + | $aid=$GLOBALS['aktion'][1]; | ||
| + | echo 'Artikel-ID: '.$aid.'[BR]'; | ||
| + | echo 'Erstellt am: ' .date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_created']) .'[BR]'; | ||
| + | echo 'Geändert am: '.date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_date']) .'[BR]'; | ||
| + | echo 'Anzeigen von: ' .date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_livedate']).'[BR]'; | ||
| + | echo 'Anzeigen bis: ' .date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_killdate']).'[BR]'; | ||
| + | [/PHP] | ||
| + | </code> | ||
| + | |||
| + | \\ | ||
| + | Im Template für den **Artikel-Listenmodus**: | ||
| + | <code php> | ||
| + | [PHP] | ||
| + | $aid={ARTICLEID}; | ||
| + | echo 'Artikel-ID: '.$aid.'[BR]'; | ||
| + | echo 'Erstellt am: ' .date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_created']) .'[BR]'; | ||
| + | echo 'Geändert am: '.date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_date']) .'[BR]'; | ||
| + | echo 'Anzeigen von: ' .date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_livedate']).'[BR]'; | ||
| + | echo 'Anzeigen bis: ' .date('d.m.Y H:i:s',$GLOBALS['content']["articles"][$aid]['article_killdate']).'[BR]'; | ||
| + | [/PHP] | ||
| + | </code> | ||
| + | |||
| + | |||
| + | |||
| \\ | \\ | ||
| Line 114: | Line 145: | ||
| // Anzahl an Top-Artikeln fuer den Artikellistenmodus in der Seitenstruktur -> Kategorie -> Anzahl an Top-Artikeln: | // Anzahl an Top-Artikeln fuer den Artikellistenmodus in der Seitenstruktur -> Kategorie -> Anzahl an Top-Artikeln: | ||
| dumpVar($GLOBALS['content']['struct'][$content['cat_id']]['acat_topcount']; // (Zaehler) | dumpVar($GLOBALS['content']['struct'][$content['cat_id']]['acat_topcount']; // (Zaehler) | ||
| + | |||
| + | // Artikeltitel des aktuellen Artikels (Detailmodus) | ||
| + | dumpVar($GLOBALS['content']['article_title']); | ||
| + | |||
| + | // Artikel-UnterTitel des aktuellen Artikels (Detailmodus) | ||
| + | dumpVar($GLOBALS['content']['articles'][$GLOBALS['content']['article_id']]['article_subtitle']); | ||
| [/PHP] | [/PHP] | ||
| Line 177: | Line 214: | ||
| \\ | \\ | ||
| - | ===== Keyword in Artikeln auslesen ===== | + | ===== Artikel-Keyword auslesen ===== |
| - | Die Variable ##$content['all_keywords']## oder ##$GLOBALS['content']['all_keywords']## wenn in Funktionen verwendet, liefert die Keywords von gerade anzuzeigenden Artikel. | + | Die Variable ##$content['all_keywords']## oder ##$GLOBALS['content']['all_keywords']## wenn in Funktionen verwendet, liefert die Keywords vom gerade anzuzeigenden Artikel. |
| - | Bsp.: //Forum [[http://forum.phpwcms.org/viewtopic.php?p=120863#p120863|Css eines Artikels ändern]]// | + | **Bsp.:** Die Keywords in ein Array schreiben: |
| + | |||
| + | <code php> | ||
| + | $keywords_array = convertStringToArray($GLOBALS['content']['all_keywords']); | ||
| + | </code> | ||
| + | |||
| + | \\ | ||
| + | |||
| + | **Bsp.:** //Forum [[http://forum.phpwcms.org/viewtopic.php?p=120863#p120863|Css eines Artikels ändern]]// | ||
| Eine spezielle CSS Formatierung für einen Artikel: | Eine spezielle CSS Formatierung für einen Artikel: | ||
| - | **Frage:** \\ | + | > **Frage:** \\ |
| - | //"Wenn ich für einen einzigen Artikel ein spezielles css angeben möchte, wo mache ich das? | + | > //"Wenn ich für einen einzigen Artikel ein spezielles css angeben möchte, wo mache ich das? |
| - | Zur Erklärung, ich möchte einzelne Artikel mit einem dunklen statt einem hellen Seitenhintergrund haben." // | + | > Zur Erklärung, ich möchte einzelne Artikel mit einem dunklen statt einem hellen Seitenhintergrund haben." // |
| - | **Antwort:** \\ | + | > **Antwort:** \\ |
| - | //"Ich würde mit einem speziellen Keyword arbeiten und mittels Frontend Render dann entsprechend darauf reagieren. | + | > //"Ich würde mit einem speziellen Keyword arbeiten und mittels Frontend Render dann entsprechend darauf reagieren. |
| Keyword "*CSS-dark*" beim Artikel ins entsprechende Feld setzen. Beim Rendering wird darauf geprüft und <body> Tag erhält die entsprechende Klasse. Das kann dann normaler per CSS definiert werden."// | Keyword "*CSS-dark*" beim Artikel ins entsprechende Feld setzen. Beim Rendering wird darauf geprüft und <body> Tag erhält die entsprechende Klasse. Das kann dann normaler per CSS definiert werden."// | ||
| Line 358: | Line 403: | ||
| ~~UP~~ | ~~UP~~ | ||
| - | ===== VORLAGE: 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. \\ | + | ===== News CP in der Detailansicht ===== |
| - | 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:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ | + | Prüfen, ob sich ein News CP in der Detailansicht befindet: |
| - | * $phpwcms['allow_ext_init'] = 1; | + | |
| + | <code PHP> | ||
| + | if(isset($_getVar['newsdetail'])) { ..... | ||
| + | </code> | ||
| - | In dem Verzeichnis **template/inc_script/frontend_init/** wird die Datei **template_inject.php** mit folgendem Inhalt abgelegt: | ||
| - | <code php|h template_inject.php |h> | + | \\ |
| - | <?php | + | ~~UP~~ |
| - | /********************************************************************************************* | + | |
| - | * 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']); | + | |
| - | + | ||
| - | ?> | + | |
| - | </code> | + | |
| - | <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> | ||