I would be the first to encourage new {RT}'s but I would also be the first to encourage them being created in phpwcms_template/inc_script/frontend_render/*.inc.php too.
As a search/replace scanes the whole {CONTENT} the least times this is done the better so editing front.func.inc.php is the most efficient way of doing the job BUT with every new upgrade it is very likley you will be giving yourself far more work transfering them over to the new front.func.inc.php with the added possibility of error.
phpwcms_template/inc_script/frontend_render/ is the final pass {CONTENT} goes through before it is rendered.
By creating a my_tags.inc.php within the phpwcms_template/inc_script/frontend_render/ folder as a repository for all your new tags & unofficial tags from this forum too you will never worry about losing your tags again. you also have no chance of corrupting the core code and spending hours debugging a stray { or ; or some other error again
the default my_tags.inc.php would be...
Code: Select all
<?php
// My {RT}'s
// This is an altered version of a function found in include/inc_front/front.func.inc.php
$content["all"] = (myTagParser ($content["all"]));// parse the whole webpage $content["all"] is the fully rendered webpage your site displays
function myTagParser($string) { // parse the $string and replace all possible instances of the following {RT}'s
// Define new {RT}'s here....
// The replacements are done here....
$string = preg_replace($search, $replace, $string);
$string = str_replace('\'', ''',$string);
$string = str_replace('"', '"',$string);
return $string;// spit out the final webpage for display
}
?>
The code with your new {RT}...
Code: Select all
<?php
// My {RT}'s
// This is an altered version of a function found in include/inc_front/front.func.inc.php
$content["all"] = (myTagParser ($content["all"]));// parse the whole webpage $content["all"] is the fully rendered webpage your site displays
function myTagParser($string) { // parse the $string and replace all possible instances of the following {RT}'s
// Define new {RT}'s here....
// place an image of given dimentions // usage: {IMAGE_SIZE:x,y}
$search[0] = '/\{IMAGE_SIZE:(.*?):(.*?):(.*?)\}/';
$replace[0] = '<img src="picture/$1" border="0" width="$2" height="$3" alt=""
// Define new {RT}'s here....increase $search[n] & $replace[n] ;)
// The replacements are done here....
$string = preg_replace($search, $replace, $string);
$string = str_replace('\'', ''',$string);
$string = str_replace('"', '"',$string);
return $string;// spit out the final webpage for display
}
?>
I am sure you understand the benefits of this method.
I am sure anyone hoping to create thier own {RT}'s would follow these hint's 'n' tips too.