{{indexmenu_n>20}} ===== /frontend_render/ ===== **Requirement:** ##<$phpwcms['allow_ext_render'] = 1;## -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\ **Description:** Into the folder **template/inc_script/frontend_render/** you can install own php scripts, which are processed while parsing //(simplified: Internal processing)// the site, before the page is delivered to the browser. All files ending with *.php are loaded and implemented by the system. The file names are freely selectable // (recommended sample: rt_mein_dateiname.php). // The sequence of processing is not assignable without special programming. The principal item is usually the variable **$content ["all"]**, which is holding the content of the page // (between **** and ****). // \\ Naturally also different system external functions can be implemented. \\ 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;## \\ ===== Important ===== **In all files in these folders should be for security reasons at the beginning of each file, the following sequence:** \\ ==== Single example: ==== The file content of a very simple procedure, which simply will write only the text // " That is an unreasonable text" // to the end of page at each page: That is an unreasonable text

'; ?>
~~UP~~ ==== Example 1: ==== The file content of a very simple example: The used tag: **{My_TicTac}**. Inserted into a cp {My_TicTac} {DATE_LONG} the result \\ My clock ist working very well. Freitag, 23. Januar 2009 at frontend. The tag is replaced by the result of the /frontend_render/ file. //(The system tag [[http://www.phpwcms-docu.de/system_tags.phtml|{DATE_LONG}]] is in use also). // ~~UP~~ ==== Example 2: ==== var2= '. $var2 . '
var3= '. $var3 . '
'. LF; return $my_result; } // {My_Tag:,,} or {My_Tag:} // ----------------------------------------------------- $content["all"] = str_replace('{My_Tag:}', func_my_tag_replacer("Werner","Ulla"), $content["all"]); $content["all"] = preg_replace('/{My_Tag:(.*?),(.*?),(.*?)}/e', 'func_my_tag_replacer("$1","$2","$3")', $content["all"]); // ----------------------------------------------------- } // -----------[ CLOSE ]---------------- ?>
\\ **Call in a CP:** {My_Tag:} {My_Tag: first mad text, second mad text, third mad text} \\ **Frontend output:** var1= Werner [Ulla + no parameter catched] var2= Ulla var3= no parameter catched var1= first mad text [ second mad text + third mad text] var2= second mad text var3= third mad text This way it is possible to solve very special problems. --- //[[flip-flop@myrealbox.com|Knut Heermann (flip-flop)]] 2009/01/23 15:19// ~~UP~~ \\ ===== Processing order of the files in /frontend_render/ ===== If you have more than one file within frontend_render and the results of the routines are depending on each other, a fundamental problem of the processing sequence is arising. \\ We canĀ“t determinethe processing sequence of the files in this folder directly. ==== Solution 01 ==== **Explained by the example NAV_HORIZ_DD and the FE language switch.** --> [[http://forum.phpwcms.org/viewtopic.php?p=119117#p119117|Forum]] - We use a custom navigation like [[english/navigation/dropdown-flyout/nav_horiz_dd|{NAV_HORIZ_DD:xx,yy}]] - We use the custom frontend_render language switch. If the frontend_render language switch is processed before the NAV_HORIZ_DD script, all language tags in this navigation file are not processed. [de]Das Haus[/de][en]The Hotel[/en][de]Urlaub & Familie[/de][en]Holidays & Family[/en] **The simplest solution:** \\ Shift the concerning files into another folder and define the correct processing order of the these files with the help of a third file. - Create a folder e.g. /frontend_render/special - Move the two files rt_nav_horiz_drop_down.php and lang_replace.php from /frontend_render/ into /frontend_render/special/ - Create a file e.g. processing_order.php in /frontend_render/ \\ ==== Solution 02 ==== To optimize the script's runtime on your server you can put the content of all /frontend_render/* files in the right order into one file e.g. called /frontend_render/master.php. Disable all other files of this folder by extending the suffix like e.g. *.php_ Thats it, we have determined the processing order. :-D \\ //(You can do this with all other php snippets in /frontend_render/ if you have similar problems).// ~~UP~~ \\ ===== Short link overview ===== {{indexmenu>english:phpwcms_replacer_rts:frontend_render|js#doku navbar msort nsort nocookie notoc}}