View Full Version : Var Plugin into template forumdisplay

18 Nov 2009, 11:41
I apologize for my bad English, we come to my problem

I created this plugin VB3

Hook: forum display_complete


$path_head = substr($path, 0, (strlen($path) - 17));

$file = $path_head.'/head/'.$foruminfo[forumid].'.html';
$head_forum = file_get_contents($file);
else {


The result was called into the template via this code

<if condition='$head_forum'>
<br />
<else />&nbsp;</if>
<!-- / Asterix special header -->

With vb4 I tried to change the code but not reported any results, the plug remained unchanged.

<!-- Asterix Special header -->
<vb:if condition="$head_forum">

{vb:raw head_forum }

<vb:else />{vb:raw file} Pippo prova&nbsp;</vb:if>
<!-- / Asterix Special header -->

The $head_forum is no longer being charged and even the variable $ file. Why?


18 Nov 2009, 14:45
One of the big changes in vB4 is that you MUST register your variable for use in a template. It's basically like telling the system that you created a variable $head_forum that you want to use in template xxxxx. So, while rendering template xxxxx, you need to say "Oh, I've got a variable $head_forum that I want to use in here". You haven't done that. You are going to have to change your plugin to do this. See this tutorial along with several blog posts on vb.com about this subject - [HOW TO - vB4] Rendering templates and registering variables - a short guide. (http://www.vbulletin.org/forum/showthread.php?t=228078) You will also have to register the variable file. Your template looks fine after you register the variables.

18 Nov 2009, 17:21
thanks for the answer I try with the guide, but not create a new template as it uses forumdisplay

--------------- Added 1258574820 at 1258574820 ---------------

Sorry for the double post, solved by adding the plugin

vB_Template::preRegister('FORUMDISPLAY',array('head_forum' => $head_forum));