{{indexmenu_n>10}} ====== Systemvariablen ====== ===== index.php?id=0,0,0,0,0,0 ===== **Systeminterne Linkdarstellung** von Kategorie, Artikel, Print. \\ Diese Darstellung kann aktiv eingesetzt werden als Link oder als Abfrage des Iststatus dienen.\\ 0 = structure ID 1 = article ID 2 = z.B. wenn 1 dann Print 3 = wenn 1 dann zeig(e/t) Kategorie 4 = wenn 1 dann Modus Artikel-Detail 5 = freie Nutzung Bereitgestellt in: /include/inc_front/content.func.inc.php $aktion = array(0,0,0,0,1,0); $aktion = explode(',', $_GET["id"], 6); $aktion[0] = intval($aktion[0]); //$aktion[0] will be always available // structure ID $aktion[1] = isset($aktion[1]) ? intval($aktion[1]) : 0; // article ID $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[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 Zugriff mit **$GLOBALS['aktion']** \\ ==== Beispiele: ==== **Die Kategorie ID:** echo 'Cat-ID: '.$GLOBALS['aktion']['0']; \\ **Die Artikel ID** //(Ausgabe nur im Artikeldetail)//: echo 'Article-ID: '.$GLOBALS['aktion']['1']; \\ Befinden wir uns in der Kategorieansicht? [1=Ja|0=Nein] \\ echo 'CatShow: '.$GLOBALS['aktion']['3']; \\ Befinden wir uns im Artikeldetail? [1=Ja|0=Nein]: \\ echo 'Detail: '.$GLOBALS['aktion']['4']; \\ **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)// \\ [0] => 7 // Kategorie-ID [1] => 26 // Artikel-ID [2] => 0 [3] => 1 // Kategorieansicht [4] => 1 // Artikel-Detailansicht [5] => 0 Als Link: ''%%index.php?id=7,26,0,1,1,0%%'' oder der direkte Artikellink: ''%%index.php?aid=26%%'' \\ **Annahme:** Eine Kategorie //(ID=2)// arbeitet im Artikellistenmodus //(ID=26,6,5,3)// //(Anzahl an Top-Artikeln: > 1, Artikelanzahl > 1)// \\ [0] => 2 // Kategorie-ID [1] => 0 [2] => 0 [3] => 1 // Kategorieansicht [4] => 0 [5] => 0 Als Link: ''%%index.php?id=2,0,0,1,0,0%%'' * In der Artikel-Detailansicht z.B. im Artikel mit der ID=6: [0] => 2 // Kategorie-ID [1] => 6 // Artikel-ID [2] => 0 [3] => 0 [4] => 1 // Artikel-Detailansicht [5] => 0 Als Link: ''%%index.php?id=2,6,0,0,1,0%%'' oder der direkte Artikellink: ''%%index.php?aid=6%%'' \\ ---- ---- \\ ===== Artikeldaten (Datum): ===== Alle Datumsangaben in einem Artikel direkt aus den Variablen generiert: Im Template für den **Artikel-Detailmodus**: [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] \\ Im Template für den **Artikel-Listenmodus**: [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] \\ ===== Var Dump (dumpVar) ===== **Die wichtigsten internen Variablen:** **Bedingung:** ''%%$phpwcms['allow_cntPHP_rt'] = 1; //allow PHP replacement tags and includes in content parts%%'' \\ [PHP] echo '
LEVEL ID
'; dumpVar($GLOBALS['LEVEL_ID']); echo '
LEVEL KEY
'; dumpVar($GLOBALS['LEVEL_KEY']); echo '
LEVEL STRUCT
'; dumpVar($GLOBALS['LEVEL_STRUCT']); echo '======================
'; dumpVar($GLOBALS['content']["articles"]); // Artikel-Struktur dumpVar($GLOBALS['content']["struct"]); // Ebenen-Struktur // article list mode: Wenn mwhr als ein Artikel verfuegbar und in der Seitenstruktur -> Kategorie -> Anzahl an Top-Artikeln: > 1 dumpVar($GLOBALS['content']["list_mode"]); // (true|false) // 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) // 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]
\\ **Ausgabemöglichkeiten** mit der Funktion ##dumpVar($var);## Bsp.: ''$_test = array ('22','phpwcms','37');'' ''dumpVar($_test); '' Array ( [0] => 22 [1] => phpwcms [2] => 37 ) HTML Code:
Array
(
    [0] => 22
    [1] => 23
    [2] => 37
    [3] => 39
    [4] => 38
    [5] => 41
)
\\ ''dumpVar($_test,1); '' \\ ''$_my_dump = dumpVar($_test,2); '' Zuweisung der Ausgabe wie ''dumpVar($_test);'' an eine Variable. \\ ~~UP~~ ---- ---- \\ ===== Artikel-Keyword auslesen ===== Die Variable ##$content['all_keywords']## oder ##$GLOBALS['content']['all_keywords']## wenn in Funktionen verwendet, liefert die Keywords vom gerade anzuzeigenden Artikel. **Bsp.:** Die Keywords in ein Array schreiben: $keywords_array = convertStringToArray($GLOBALS['content']['all_keywords']); \\ **Bsp.:** //Forum [[http://forum.phpwcms.org/viewtopic.php?p=120863#p120863|Css eines Artikels ändern]]// Eine spezielle CSS Formatierung für einen Artikel: > **Frage:** \\ > //"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." // > **Antwort:** \\ > //"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 Tag erhält die entsprechende Klasse. Das kann dann normaler per CSS definiert werden."// {{:deutsch:technik:article_keyword_de.gif|}} **frontend_init** if(strpos($content['all_keywords'], '*CSS-dark*')!== false) { $template_default['body']['class'] = 'dark level-'; $content['all_keywords'] = str_replace('*CSS-dark*', '', $content['all_keywords']); } ?> ** CSS:** body.dark { background-color: #666666; } **Achtung** - die Klasse(n) "dark level-" wurde bewußt so gewählt, da immer noch zusätzlich die Level ID mitgegeben wird. ~~UP~~ ---- ---- \\ ===== Der neue Tag {LEVELX_ID} ===== Update 25.06.2009: [[http://code.google.com/p/phpwcms/source/detail?r=317|Revision: r317]] Es kann nun direkt die aktuelle Kategorie-ID bezogen auf das Level ausgelesen werden.

Old Level-Ids:
---------------------------
[PHP] // Old Level-Ids echo ( (isset($GLOBALS['LEVEL_ID'][1])) ? ( 'Level 1 ID='. $GLOBALS['LEVEL_ID'][1]) : 'no level 1' ) . '
'; echo ( (isset($GLOBALS['LEVEL_ID'][2])) ? ( 'Level 2 ID='. $GLOBALS['LEVEL_ID'][2]) : 'no level 2' ) . '
'; echo ( (isset($GLOBALS['LEVEL_ID'][3])) ? ( 'Level 3 ID='. $GLOBALS['LEVEL_ID'][3]) : 'no level 3' ) . '
'; echo ( (isset($GLOBALS['LEVEL_ID'][4])) ? ( 'Level 4 ID='. $GLOBALS['LEVEL_ID'][4]) : 'no level 4' ) . '
'; [/PHP]
New Level-Ids (since r317):
---------------------------
{LEVEL1_ID:} {LEVEL1_ID}
{LEVEL2_ID:} {LEVEL2_ID}
{LEVEL3_ID:} {LEVEL3_ID}
{LEVEL4_ID:} {LEVEL4_ID}
---------------------------
~~UP~~ ---- ---- ===== FE Ausgabe {LEVCATID} ===== **Aktuelle Nr. der Ebene / Aktueller Kategorie-Alias / Aktuelle Kategorie-ID** **Autor:** K.Heermann (flip-flop) http://planmatrix.de //2009/05/14 // \\ **CMS-Version:** >= V1.2.7 \\ **Tag:** {LEVCATID} \\ **Datei:** template/inc_script/frontend_render/rt_levcatid.php \\ **Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_render'] = 1; '.LEV_CAT_ID().'', $content['all']); ?> ---- ---- \\ Siehe zu Variablen auch [[:deutsch:ersetzer_rts:frontend_render:standard_tags_assembled|Standard Tags zusammengefasst]] \\ ~~UP~~ ===== GET Variable setzen und auslesen ===== Beispiel: Die Variable wird "cpimage" genannt und beinhaltet einen Integer-Wert. === Vorbereiten der Adresse: === $site = $GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root']; $cat_alias = $GLOBALS['content']["struct"][$GLOBALS['content']["cat_id"]]["acat_alias"]; $href_str = $site.'index.php?'.$cat_alias; $get_str = 'cpimage='; \\ === Variable setzen: === z.B. ##http://my_site.tld/index.php?active_category&**cpimage=34** ## $my_number = 34; $my_complete_link = $href_str.'&'.$get_str.$my_number; // http://my_site.tld/index.php?active_category&cpimage=34 \\ === Variable auslesen: === // Is there a GET var? if (isset($GLOBALS['_getVar']['cpimage'])) { $GLOBALS['_getVar']['cpimage'] = intval($GLOBALS['_getVar']['cpimage']); // Convert to integer $cpImgNr = $GLOBALS['_getVar']['cpimage']; } else $cpImgNr = false; // if there is no GET var set it to false Der Integerwert in **$cpImgNr** kann nun verarbeitet werden, bzw. sollte vorher auf "false" geprüft werden. \\ === Als Tag: === {PHPVAR:$GLOBALS['_getVar']['cpimage']} \\ ~~UP~~ ===== News CP in der Detailansicht ===== Prüfen, ob sich ein News CP in der Detailansicht befindet: if(isset($_getVar['newsdetail'])) { ..... \\ ~~UP~~