NEWS: TAG output in template

Output of the used news tags from the CP in the template in a defined place.

Description:

- The used tags from the CP news are displayed in place of the placeholder {#NEWS_TAGS#} in the template.



Docu: –
Forum: –

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

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_init'] = 1;



PHP:

Datei: /template/inc_script/frontend_init/cp_trig_news01.php

cp_trig_news01.php

<?php
// -------------------------------------------------------------------------------------------
// obligate check for phpwcms constants
    if (!defined('PHPWCMS_ROOT')) {
        die("You Cannot Access This Script Directly, Have a Nice Day."); }
// -------------------------------------------------------------------------------------------
 
// 27.05.10 KH: http://planmatrix.de
// CP trigger: NEWS Tags ausgeben V1.0
// Template: An der Stelle {#NEWS_TAGS#} werden die verwendeten Tags ausgegeben
// --------------------------------------------------------------------------------------------
 
function NEWS_TAGS($text, & $data) {
 
    // Der richtige CP news (33) und Tag vorhanden?
    if     ( $data['acontent_type'] == 33  AND ( strpos($text, '{#NEWS_TAGS#}') ) )  {
 
        $str = unserialize($data['acontent_form']);
 
        if (!empty($str['news_category'])) {
 
            $str = implode (', ',$str['news_category']);
 
        } else
            $str = '';
 
        $text = str_replace('{#NEWS_TAGS#}',$str,$text);
    }
 
    return $text;
    }
 
    register_cp_trigger('NEWS_TAGS');
 
?>
english/phpwcms_replacer_rts/frontend_init/cp_trigger/news-tag-output-in-template.txt · Last modified: 2018/06/03 18:09 (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