Scanu
07-27-2012, 07:38 PM
Hi i'm trying to make a function for editing templates this is what i make
require_once(DIR . '/includes/class_template_parser.php');
function template_include ($template_name,$code,$position) {
$parser = new vB_TemplateParser($code);
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
if ($position = 'end'){
$include = ' $final_rendered .= \' '.trim($parser->_parse_nodes($parser->dom_doc->childNodes())).'\'; ';
$vbulletin->templatecache[''.$template_name] .= $include;
} else {
$include = '$final_rendered = \' '.trim($parser->_parse_nodes($parser->dom_doc->childNodes())) . '\' . ';
$vbulletin->templatecache[''.$template_name] = substr_replace($vbulletin->templatecache[''.$template_name], $include, 0, 17);
}
}
template_include('header','test','end');
but it doesn't work it seems that "$vbulletin->templatecache[''.$template_name] .= $include;" doesn't work in a function.. where am i wrong :S
--------------- Added 1343499648 at 1343499648 ---------------
The variable $vbulletin->templatecache['.....'] isn't working in a function! Why? :(
require_once(DIR . '/includes/class_template_parser.php');
function template_include ($template_name,$code,$position) {
$parser = new vB_TemplateParser($code);
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
if ($position = 'end'){
$include = ' $final_rendered .= \' '.trim($parser->_parse_nodes($parser->dom_doc->childNodes())).'\'; ';
$vbulletin->templatecache[''.$template_name] .= $include;
} else {
$include = '$final_rendered = \' '.trim($parser->_parse_nodes($parser->dom_doc->childNodes())) . '\' . ';
$vbulletin->templatecache[''.$template_name] = substr_replace($vbulletin->templatecache[''.$template_name], $include, 0, 17);
}
}
template_include('header','test','end');
but it doesn't work it seems that "$vbulletin->templatecache[''.$template_name] .= $include;" doesn't work in a function.. where am i wrong :S
--------------- Added 1343499648 at 1343499648 ---------------
The variable $vbulletin->templatecache['.....'] isn't working in a function! Why? :(