Differences

This shows you the differences between two versions of the page.

english:phpwcms_replacer_rts:frontend_render [2009/07/09 12:02]
Knut Heermann (flip-flop)
english:phpwcms_replacer_rts:frontend_render [2018/06/03 18:09] (current)
Line 1: Line 1:
{{indexmenu_n>20}} {{indexmenu_n>20}}
-===== /fronten_render/ =====+===== /frontend_render/ ===== 
 + 
 + 
 +**Requirement:** ##<$phpwcms['allow_ext_render']  = 1;## -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]]
-**Requirement:** Setting in [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|conf.inc.php]] 
-<code php>$phpwcms['allow_ext_render']  = 1;        //allow including of custom external scripts at frontend rendering</code> 
\\ \\
**Description:** **Description:**
-\\ 
-In the folder /frontend_render/ you can be put down php scripts, which during parsing //(simplified: Internal processing)// the side to be processed, before the page is delivered to the browser. 
-All files with the ending *.php are loaded and implemented from the system. The file names are freely selectable // (recommended sample: rt_mein_dateiname.php). // +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.
-The sequence is not assignable. +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 principal item is usually the variable **$content ["all"]**, which holds the content of the side // (between **<body>** and **</body>**). // +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 **<body>** and **</body>**). //
\\ \\
Line 23: Line 24:
Naturally also different system external functions can be implemented. 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:**
 +<file>
 +<?php
 +// ----------------------------------------------------------------
 +// obligate check for phpwcms constants
 +if (!defined('PHPWCMS_ROOT')) {
 +   die("You Cannot Access This Script Directly, Have a Nice Day."); }
 +// ----------------------------------------------------------------
 +...
 +...
 +</file>
 +
 +\\
==== Single example: ==== ==== Single example: ====
Line 29: Line 53:
-The file content of a very simple procedure, which writes simply only the text // " That is an unreasonable text" // to the end of page at each side:+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:
<code php> <code php>
Line 48: Line 72:
==== Example 1: ==== ==== Example 1: ====
-The file content from a very simple example:+The file content of a very simple example:
<code php> <code php>
<?php <?php
Line 69: Line 93:
 at frontend.  at frontend.
-The tag is replaced from the result out of the /frontend_render/ file. //(The system tag [[http://www.phpwcms-docu.de/system_tags.phtml|{DATE_LONG}]] is also in use). //+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~~ ~~UP~~
Line 123: Line 147:
} }
- 
-$content["all"] = str_replace('{My_TicTac}', 'My clock ist working very well.', $content["all"]); 
// -----------[ CLOSE ]---------------- // -----------[ CLOSE ]----------------
Line 130: Line 152:
</code> </code>
\\ \\
-**Aufruf in einem CP:** +**Call in a CP:**
  {My_Tag:}   {My_Tag:}
     
-  {My_Tag: erster toller Text, zweiter toller text, dritter toller Text}+  {My_Tag: first mad text, second mad text, third mad text}
\\ \\
Line 142: Line 164:
  var3= no parameter catched   var3= no parameter catched
     
-  var1= erster toller Text [ zweiter toller text + dritter toller Text+  var1= first mad text [ second mad text + third mad text
-  var2= zweiter toller text +  var2= second mad text 
-  var3= dritter toller Text+  var3= third mad text
-So it is possible to solve very special cases.+This way it is possible to solve very special problems.
 --- //[[flip-flop@myrealbox.com|Knut Heermann (flip-flop)]] 2009/01/23 15:19//  --- //[[flip-flop@myrealbox.com|Knut Heermann (flip-flop)]] 2009/01/23 15:19//
Line 152: Line 174:
~~UP~~ ~~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/
 +
 +<code php|h processing_order.php >
 +<?php
 +
 +// ----------------------------------------------------------------
 +// obligate check for phpwcms constants
 +if (!defined('PHPWCMS_ROOT')) {
 +   die("You Cannot Access This Script Directly, Have a Nice Day.");
 +}
 +// ----------------------------------------------------------------
 +
 +// Specifies the sequence of processing files
 +include ('special/rt_nav_horiz_drop_down.php');  // processing first
 +include ('special/lang_replace.php');            // processing second
 +
 +?>
 +</code>
 +\\
 +
 +==== 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 ===== ===== Short link overview =====
english/phpwcms_replacer_rts/frontend_render.1247133726.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