This is an old revision of the document!


Erweiterungen

frontend_render

Bisher ist es nicht möglich die Standard-TAGs aus dem CMS-System im Shoptemplate zu verwenden. Eine kleine Erweiterung schafft Abhilfe.

Die Datei /include/inc_module/mod_shop/frontend.render.php wird um eine Zeile erweitert um das unten aufgeführte PHP-Script zu laden.

Am Ende der Datei frontend.render.php vor ?> bitte folgendes einfügen:

// **** Special extension for cms TAGs *** KH: 20.01.2011***********************
// *****************************************************************************
    include($phpwcms['modules']['shop']['path'].'custom_fe_render.php');
// *****************************************************************************

Nun werden die Anweisungen in der Datei custom_fe_render.php beim Rendern des Templates berücksichtigt.

PHP-Script

custom_fe_render.php

<?php
/**
 *******************************************************************************
 * Special extension for cms TAGs
 * KH flip-flop: 20.01.2011
 * Parses all between <!--SHOP-BEGIN--> .... and .... <!--SHOP-END-->
 *******************************************************************************
*/
// -----------------------------------------------------------------------------
// obligate check for phpwcms constants
  if (!defined('PHPWCMS_ROOT'))
     {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// -----------------------------------------------------------------------------
 
 
if(strpos($content["all"],'<!--SHOP-BEGIN-->') !== false) {
    preg_match('/\<!--SHOP-BEGIN--\>(.*?)\<!--SHOP-END--\>/is', $content['all'], $my_arr);
//    dumpVar($string);
 
    if (!empty($my_arr[1])) {
 
        $string = $my_arr[1];
 
        // +KH 19.01.11 parse SHOW_CONTENT a second time ----------------
        while (strpos($string, '{SHOW_CONTENT:') != false)
            $string = preg_replace('/\{SHOW_CONTENT:(.*?)\}/e', 'showSelectedContent("$1");', $string);
 
            // include external PHP script (also normal HTML snippets) or return PHP var value +KH: 04.04.2010
            if(!empty($phpwcms["allow_cntPHP_rt"]))
                $string = render_PHPcode($string);
 
            // parses all system RTs -------------------
            $string = html_parser($string);
 
            // Special for eMail mailto:.... --------------------
            if ( ($phpwcms["allow_ext_render"]) AND (strpos($string, 'mailto:') != false) ) {
 
            // try to include custom functions and replacement tags or what you want to do at this point of the script
            // default dir: "phpwcms_template/inc_script/frontend_render"; only *.php files are allowed there
                if ( is_file(PHPWCMS_TEMPLATE.'inc_script/frontend_render/makeEmailSpamSave.php') ) {
 
                    include_once(PHPWCMS_TEMPLATE.'inc_script/frontend_render/makeEmailSpamSave.php');
                    $string = replaceEmailAddress($string);
                }
            }
 
        // img and Download TAGs -----------------------
        $string = preg_replace_callback('/\[img=(\d+)(.*?){0,1}\](.*?)\[\/img\]/i', 'parse_images', $string);
        $string = preg_replace_callback('/\[img=(\d+)(.*?){0,1}\]/i', 'parse_images', $string);
        $string = preg_replace_callback('/\[download=(.*?)\/\]/i', 'parse_downloads', $string);
        $string = preg_replace_callback('/\[download=(.*?)\](.*?)\[\/download\]/is', 'parse_downloads', $string);
 
        // Replace all ------------------
        $content['all'] = preg_replace('/\<!--SHOP-BEGIN--\>(.*?)\<!--SHOP-END--\>/is', $string, $content['all']);
 
 
    }
}
// *****************************************************************************
 
?>


Einbinden

Um das Script nutzen zu können muss der zu parsende Bereich im Shopaufruf kenntlich gemacht werden mit den beiden TAGs

<!--SHOP-BEGIN-->
und
<!--SHOP-END-->

Z.B. im Shopaufruf:

<!--SHOP-BEGIN-->
<hr />
<h2>Category</h2>
{SHOP_CATEGORIES}
<hr />
{SHOP_PRODUCTLIST}
<hr />
{CART_SMALL}
 
<hr />
<hr />
{SHOP_ORDER_PROCESS}
<!--SHOP-END-->


Das Script kann an die speziellen Bedürfnisse angepasst werden. Die meisten CMS-TAGs finden wir in include/inc_front/content.func.inc.php.


deutsch/module/shop/erweiterungen.1308382251.txt.gz · Last modified: 2018/06/03 18:07 (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