{{indexmenu_n>420}} ====== Wrap Artikelliste/detail ====== **Dieser RT legt einen Umschließer //(Wrapper)// um eine Artikelliste oder Artikeldetailliste.** Dazu werden im jeweiligen Template zwei neue Tags benötigt **%%%%** und **%%%%**. Eingebaute Alternative //(seit V1.3.3 2007-05-18)//: [[deutsch/phpwcms-system/artikel#wrapper_fuer_artikellisten_-und_detaildarstellung|Wrapper für Artikellisten -und Detaildarstellung:]] \\ ---- **rt_article_list_wrap** V1.0 2010/02/23 **Docu:** -- \\ **Forum:** [[http://forum.phpwcms.org/viewtopic.php?p=122781#p122781|wrap article summary list template]] \\ **Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS Version:** >= 1.3 \\ **Version:** V1.0 \\ **Tag:** ##%%%%## und ##%%%%## **Dateiname:** rt_article_list_wrap.php **Ort:** template/inc_script/frontend_render/ **Bedingung:** -> [[http://www.phpwcms-docu.de/config_dateien.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_render'] = 1; ---- ---- \\ ===== Template: ===== TAG im Artikel-Listen/Detail-Template: ..... ..... article list template ..... ..... \\ Der vom System erzeugte Quelltext sieht nun so aus: .... .... .... .... \\ Nach dem Scriptdurchlauf:
.... .... .... ....
Das erste ''%%%%'' wird durch die Anweisung in ''$_prefix'' im Script ersetzt. Das letzte ''%%%%'' wird durch die Anweisung in ''$_suffix'' im Script ersetzt. \\ ===== PHP: ===== In den beiden Variablen $_prefix und $_suffix werden die umschließenden Anweisungen eingetragen. $_prefix = '
'; // before articles-list $_suffix = '
'; // behind articles-list
\\ **Datei:** template/inc_script/frontend_render/rt_article_list_wrap.php * * article list template * * * ---------------------------------- * * Filename: rt_article_list_wrapper.php * Folder: /template/inc_script/frontend_render/ * Switch: $phpwcms['allow_ext_render'] = 1; (/config/phpwcms/conf.inc.php) * * Forum: http://forum.phpwcms.org/viewtopic.php?p=110038#p110038 *******************************************************************/ // ---------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ---------------------------------------------------------------- // Article list wrapper // ================================================================ // Is there the right article list? if( ! (strpos($content["all"],'') === false)) { // -----CUSTOM------------------------------------ $_prefix = '
'; // before articles-list $_suffix = '
'; // behind articles-list $_a_entry = ''; $_a_end = ''; // ----------------------------------------------- // reverting for faster replace $_a_end = strrev($_a_end); $_suffix = strrev($_suffix); // make a regex like pattern $_a_entry = preg_quote($_a_entry, '/'); $_a_end = preg_quote($_a_end, '/'); // Only the first entry // ---------------------------------- $content["all"] = preg_replace('/'.$_a_entry.'/',$_prefix.LF,$content["all"],1); // Only the last entry (reverting is much faster as REGEX (last)) // ---------------------------------- $content["all"] = strrev($content["all"]); $content["all"] = preg_replace('/'.$_a_end.'/',$_suffix.LF,$content["all"],1); $content["all"] = strrev($content["all"]); } ?>