{{indexmenu_n>100}} ====== CP-Daten (Datum) ====== **Stellt das Erstellungs- und Änderungsdatum des betreffenden CPs bereit.** \\ -> {CPDATE_CREATEDX} und {CPDATE_CHANGEDX} ===== Beschreibung: ===== Der jeweilige Aufruf sieht so aus, je nach Freigabe im Script //(Beispiel: "CPDATE_CREATEDX")//: * {CPDATE_CREATEDX} //(Einfache schnelle Version, mit Ausgabeformateinstellungen im Script)// * {CPDATE_CREATEDX} //(Einfache Version, mit Ausgabeformat- und Spracheinstellungen im Script)// * {CPDATE_CREATEDX:Y-m-d H:i:s} oder {CPDATE_CREATEDX:l, d.m.Y H:i lang=DE} //Komfortable jedoch langsamste Version mit allen Parametern im TAG // Im Script wird durch Aus/Entkommentieren von nummerierten Script-Blöcken festgelegt, welches Verfahren angewendet wird. Es sollten nur die verwendeten Verfahren aktiv sein um Geschwindigkeitsverluste beim Rendern zu vermeiden. Das Script wird für jeden CP einzeln angesprochen! Mögliche Kombinationen der einzelnen Script-Blöcke: 1) allein, 2) allein, 3) allein, 1) und 3), 2) und 3) Dazu kann bestimmt werden in welchen [[deutsch/technik/aufruf-interner-funktionen/content_part_typen]] die TAGs gesucht werden sollen. Wird das einführende IF-Statement mit seiner schließenden Klammer auskommentiert, werden alle CPs untersucht. (Geschwindigkeit!!) \\ ---- Docu: -- \\ Forum: -- **Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS Version:** >= 1.3x \\ **Version:** V1.0 //(29.01.2011)// \\ **Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_init'] = 1; ---- \\ \\ ===== PHP: ===== Datei: **/template/inc_script/frontend_init/cp_trig_cp_date.php** Plain Text, 6 => HTML, 15 => WYSIWYG, 29 => IMAGE
// If you don´t need a filter (all CPs will be processed), please disable the if statement and the associated closing parenthesis if( in_array($data['acontent_type'], array(0,6,14,29)) ) { // is used only when the CP-filter should be used. // 1) Very fast but simple with paramter in script without language setting for e.g. day names // e.g. {CPDATE_CREATEDX} $text = str_replace("{CPDATE_CREATEDX}", date('d.m.Y H:i:s',strtotime($data['acontent_created'])), $text); // replace cp date created $text = str_replace("{CPDATE_CHANGEDX}", date('d.m.Y H:i:s',strtotime($data['acontent_tstamp'])), $text); // replace cp date changed // 2) Fast and more complex with parameter and language setting in script // e.g. {CPDATE_CREATEDX} // $text = str_replace("{CPDATE_CREATEDX}", international_date_format('DE', 'l, d.m.Y',strtotime($data['acontent_created'])), $text); // $text = str_replace("{CPDATE_CHANGEDX}", international_date_format('DE', 'l, d.m.Y',strtotime($data['acontent_tstamp'])), $text); // 3) Slower speed for TAG with parameter (and language setting) in TAG // e.g. {CPDATE_CREATEDX:Y-m-d H:i:s} or {CPDATE_CREATEDX:l, d.m.Y H:i lang=DE} $text = render_date($text, strtotime($data['acontent_created']), 'CPDATE_CREATEDX'); $text = render_date($text, strtotime($data['acontent_tstamp']), 'CPDATE_CHANGEDX'); } // is used only when the CP-filter should be used. return $text; } // Possible combinations: 1) only, 2) only, 3) only, 1)and 3), 2) and 3) register_cp_trigger('CP_Date_created_change'); ?> \\