PDA

View Full Version : Automated template edit problem


Harutyun Dr.
05-11-2008, 09:38 AM
I'm writing plugin wich adds some link to navbar. I'm trying to replace string
<if condition='"$vboptions['enablememberlist']"> with some string added to it. So i wrote
$vbulletin->templatecache['navbar'] = str_replace('<if condition="$vboptions[\'enablememberlist\']">', 'some string'.'<if condition="$vboptions[\'enablememberlist\']">', $vbulletin->templatecache['navbar']);
But it doesn't work. Can someone help me? Thanks:)

Boofo
05-11-2008, 09:43 AM
That won't work. This is what you need to replace:

".(($GLOBALS['vbulletin']->options['enablememberlist']) ? ("

and you need to replace it with the corresponding code. Look in your template table in phpmyadmin, if possible.

Harutyun Dr.
05-12-2008, 12:11 PM
Yes, i've seen that in temlatecache there is a such string, but replacement gives an error (my pages don't load completely after i've installed my plugin)
the code is:

$lookfor='".(($GLOBALS[\'vbulletin\']->options[\'enablememberlist\']) ? ("';
$replace='some text'.$lookfor;
$vbulletin->templatecache['navbar'] = str_replace($lookfor, $replace, $vbulletin->templatecache['navbar']);

So why it doesn't work???

Boofo
05-12-2008, 06:04 PM
Because it is wrong maybe???

Try this:

$lookfor='".(($GLOBALS[\'vbulletin\']->options[\'enablememberlist\']) ? ("';
$replace='some text';
$vbulletin->templatecache['navbar'] = str_replace($lookfor, $replace, $vbulletin->templatecache['navbar']);

Harutyun Dr.
05-13-2008, 06:34 AM
Thanks a lot, it's OK now!:D