NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:ersetzer_rts:frontend_render:datum-letztes-update [2018/06/03 18:09] 127.0.0.1 external edit |
deutsch:ersetzer_rts:frontend_render:datum-letztes-update [2020/03/23 11:05] (current) Uwe Tholey |
||
|---|---|---|---|
| Line 39: | Line 39: | ||
| **Bedingung:** -> [[http://www.phpwcms-docu.de/config_dateien.phtml|/config/phpwcms/conf.inc.php]] \\ | **Bedingung:** -> [[http://www.phpwcms-docu.de/config_dateien.phtml|/config/phpwcms/conf.inc.php]] \\ | ||
| - | * ##$phpwcms['allow_ext_render'] = 1;## | + | * ##$phpwcms['allow_ext_render'] = 1;## \\ |
| Line 196: | Line 196: | ||
| \\ | \\ | ||
| + | |||
| + | ====== Datum Letztes Update Artikel & CP V 2.0===== | ||
| + | **rt_date_last_update** V2.0 22.05.2018\\ | ||
| + | Forum: [[https://forum.phpwcms.org/viewtopic.php?p=148787#p148787]]\\ | ||
| + | Autor: Oliver Georgi (phpwcms developer)\\ | ||
| + | TAG: **{DATE_UPDATE:d.m.Y H:i}** oder ohne Angabe der Uhrzeit **{DATE_UPDATE:d.m.Y}** \\ | ||
| + | Dateiname: **last_update.php**\\ | ||
| + | Verzeichnis: ** template/inc_script/frontend_render/ **\\ | ||
| + | phpwcms Version: ab 1.9 (PHP 7)\\ | ||
| + | Bedingung: -> [[http://www.phpwcms-docu.de/config_dateien.phtml|include/config/phpwcms/conf.inc.php]] \\ | ||
| + | |||
| + | * ##$phpwcms['allow_ext_render'] = 1;## \\ | ||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | ===== Beschreibung und Verwendung: ===== | ||
| + | - Script in das Verzeichnis template/inc_script/frontend_render/ kopieren \\ | ||
| + | - TAG **{DATE_UPDATE:d.m.Y H:i}** bzw. **{DATE_UPDATE:d.m.Y}** an der gewünschten Stelle im Template, wo die Ausgabe erfolgen soll, platzieren.\\ | ||
| + | \\ | ||
| + | :!: Im Script kann nicht mehr eingestellt werden wie die Ausgabe erfolgen soll. Es wird das Datum der letzten Aktualisierung ausgegeben, unabhängig davon ob Inhalte öffentlich oder nicht öffentlich sind.\\ | ||
| + | :!: In lokalen Serverumgebungen, z.B. xampp unter Windows, ist es möglich daß die Ausgabe fehlerhaft ist. Siehe hierzu im Forum [[https://forum.phpwcms.org/viewtopic.php?p=148794#p148794]] | ||
| + | \\ | ||
| + | |||
| + | ===== Script: ===== | ||
| + | |||
| + | Dateiname: last_update.php \\ | ||
| + | Verzeichnis: template/inc_script/frontend_render/ | ||
| + | <code php |h last_update |h > | ||
| + | <?php | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | // ------------- Move this Script into template/inc_script/frontend_render ------------------- | ||
| + | // --------------- Use {DATE_UPDATE:d.m.Y H:i} as RT in your Template. ----------------------- | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | // obligate check for phpwcms constants | ||
| + | if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | if( ! (strpos($content["all"],'{DATE_UPDATE')===false)) { | ||
| + | |||
| + | $sql = 'SELECT UNIX_TIMESTAMP(latest_ts) AS latest_ts FROM(( | ||
| + | SELECT MAX(article_tstamp) AS latest_ts FROM '.DB_PREPEND.'phpwcms_article WHERE article_deleted=0 AND article_public=1 LIMIT 1) | ||
| + | UNION | ||
| + | (SELECT MAX(acat_tstamp) AS latest_ts FROM '.DB_PREPEND.'phpwcms_articlecat WHERE acat_trash=0 AND acat_aktiv=1 LIMIT 1) | ||
| + | UNION | ||
| + | (SELECT MAX(acontent_tstamp) AS latest_ts FROM '.DB_PREPEND.'phpwcms_articlecontent WHERE acontent_visible=1 AND acontent_trash=0 LIMIT 1) | ||
| + | ) AS t1 LIMIT 1'; | ||
| + | |||
| + | $result = _dbQuery($sql); | ||
| + | if(isset($result[0]['latest_ts'])) { | ||
| + | $content["all"] = render_date($content["all"], $result[0]['latest_ts'], 'DATE_UPDATE'); | ||
| + | } else { | ||
| + | // Render Fallback date! | ||
| + | $content["all"] = render_date($content["all"], now(), 'DATE_UPDATE'); | ||
| + | } | ||
| + | } | ||
| + | ?> | ||
| + | </code> | ||