This is an old revision of the document!


Date: Last update artikel & cp

FIXME Better translate

RT to view the date of the last inserted/modified article or content part of the whole page.

In the script can be set if the articles/CPs in hidden categories should be included.
Articles not included that are located within custom/protected categories.

The output can be customized according to the usual php-date rules. E.g. {DATE_UPDATE:d.m.Y H:m} delivers 01.02.2010 12:23
or in the script is changed to set the format as in “conf.template.default.inc.php”. The TAG for this: {DATE_UPDATE}.
(At the end of the script, uncomment the line).

Similar function, see: NEWX



rt_date_last_update V1.0 22.04.2011

Docu: –
Forum: http://forum.phpwcms.org/viewtopic.php?f=16&t=21358

Author: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.3
Version: V1.0

TAG: {DATE_UPDATE} oder z.B. {DATE_UPDATE:d.m.Y H:m}

Filename: rt_date_last_update.php

Folder: template/inc_script/frontend_render/

*Condition: → [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]

  • $phpwcms['allow_ext_render'] = 1;



Description:

Settings of the variable $show_hidden: [0|1|2]

  • Search by article date in
  • - [0] not hidden categories
  • - [1] only hidden categories
  • - [2] all categories


The TAG {DATE_UPDATE} - commented lines at the end of the script:

In one of these lines the comment can be removed to activate {DATE_UPDATE}.
The output settings of the date in this case relate to the variables in the file
“config/phpwcms/conf.template.default.inc.php”.

  • $template_default['date']['long']
  • $template_default['date']['medium']
  • $template_default['date']['short']

The fourth line provides the output settings of the date directly in the script.


Script:

Filename: rt_date_last_update.php
Folder: template/inc_script/frontend_render/

rt_date_last_update

<?php
/**
 *********************************************************************************************
 * The most recent Article date of the entire page (Article and CP)
 * 2011/04/22 V1.0  Knut Heermann (flip-flop) http://planmatrix.de
 *
 * Settings: @show_hidden: [0|1|2]
 * Search for article date in
 *  - [0] not hidden categories
 *  - [1] only hidden categories
 *  - [2] all categories
 *
 * TAG:    E.g. {DATE_UPDATE:d.m.Y H:m} or optional {DATE_UPDATE}
 *
 * Output: Optional settings from "conf.template.default.inc.php". Have a look to
 *         $template_default["date"]["language"] and
 *         $template_default["date"]["long"/medium/short]
 *         - Enable/disable at the end of the script
 *         - or manual in script
 *
 *********************************************************************************************
 */
 
// -------------------------------------------------------------------------------------------
// 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)) {
 
    // category: "hide" or "visible when active"
    // --------------------------------------------
    $show_hidden = 2;  // [0] = not hidden categories  [1] = only hidden categories   [2] = all categories
    // --------------------------------------------
 
    $sql  =    "SELECT article_id, UNIX_TIMESTAMP(max(article_tstamp)) AS max_article_tstamp, ";
    $sql .= "article_begin AS article_livedate, ";
    $sql .= "article_end AS article_killdate ";
    $sql .=    "FROM ".DB_PREPEND."phpwcms_article ar LEFT JOIN ".DB_PREPEND."phpwcms_articlecat ac ON ";
    $sql .=    "ar.article_cid = ac.acat_id WHERE ";
    // Categorie settings -------------
    $sql .= "ac.acat_aktiv=1 AND ac.acat_public=1 AND ac.acat_trash=0 AND ";
 
    // category: "hide" or "visible when active"
    switch ($show_hidden) {
        case 0: $sql .= "ac.acat_hidden=0 AND ";        // "hide" or "visible when active"
                break;
        case 1: $sql .= "ac.acat_hidden>=1 AND ";        // "hide" or "visible when active"
                break;
        default: $sql .= "";                            // all categories
 
    }
    $sql .= "ac.acat_regonly=0 AND ";                    // "visible for users logged on only"
    // Article settings ---------------
    $sql .= "ar.article_public=1 AND ar.article_aktiv=1 AND ";
 
    // Article settings
    $sql .= "ar.article_deleted=0 AND ar.article_begin<NOW() ";
    $sql .= "AND IF(ac.acat_archive=1 AND ar.article_archive_status=1, 1, ar.article_end>NOW()) LIMIT 1";
 
    $result = _dbQuery($sql);
 
    $my_date = (isset($result['0']['max_article_tstamp'])) ? $result['0']['max_article_tstamp']: '--';
 
 
    // Enable / disable the output form
    // Optional settings from "conf.template.default.inc.php". Have a look to
    // $template_default["date"]["language"] and
    // $template_default["date"]["long"/medium/short]
    // ------------------------------------------------
//    $content["all"] = str_replace('{DATE_UPDATE}', international_date_format($template_default["date"]["language"], $template_default["date"]["long"],    $my_date),   $content["all"]);
//    $content["all"] = str_replace('{DATE_UPDATE}', international_date_format($template_default["date"]["language"], $template_default["date"]["medium"], $my_date),   $content["all"]);
//    $content["all"] = str_replace('{DATE_UPDATE}', international_date_format($template_default["date"]["language"], $template_default["date"]["short"],  $my_date),   $content["all"]);
//    $content["all"] = str_replace('{DATE_UPDATE}', international_date_format($template_default["date"]["language"], 'd.m.Y H:m',                          $my_date),   $content["all"]);
 
    $content["all"] = render_date($content["all"], $my_date, 'DATE_UPDATE');
 
}
 
?>


english/phpwcms_replacer_rts/frontend_render/date-last-update.1303555256.txt.gz · 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