Log in

View Full Version : How to make this code works in vb4?


almannai
01-11-2010, 05:36 AM
Hi all

Any help will be apriatiated

the following code that is working in vb3 is giving error in vb4

<plugin active="1" executionorder="5">
<hookname>global_start</hookname>
<phpcode><![CDATA[
switch ($vbulletin->options['myplugin_place'])
{
case 1:
$place = '$header';
break;
case 2:
$place = '$navbar';
break;
default:
$place = '$navbar';
break;
}

if ($place == '$navbar'){
$vbulletin->templatecache['FORUMDISPLAY'] = str_replace($place, $place . $vbulletin->templatecache['myplugin_template'], $vbulletin->templatecache['FORUMDISPLAY']);
$vbulletin->templatecache['FORUMHOME'] = str_replace($place, $place . $vbulletin->templatecache['myplugin_template'], $vbulletin->templatecache['FORUMHOME']);
}else{
$vbulletin->templatecache['FORUMHOME'] = str_replace($place, $place . $vbulletin->templatecache['myplugin_template'], $vbulletin->templatecache['FORUMHOME']);
}

]]></phpcode>
</plugin>


the error is

Parse error: syntax error, unexpected T_STRING, expecting T_PAAMAYIM_NEKUDOTAYIM in class_core.php(3811) : eval()'d code on line 13


So can someone tell me what am doing wrong? Please show some examples to fix it.

Regards,

Lynne
01-11-2010, 02:38 PM
How can you replace $navbar in FORUMDISPLAY when there is no $navbar in either of those templates any longer? You will need to look at the FORUMDISPLAY and FORUMHOME templates to find the appropriate lines to replace. (FORUMHOME now has a template_hook near the top that you could probably use).

Paul M
01-22-2010, 09:57 AM
You should also note that global_start is going to be removed at some point, both from the CMS and eventually the forums, so you should look to use a different hook.