WorldCraft
08-01-2013, 10:25 PM
Hello. I'm trying to move the Forum Statistics from What's Going On into a forum block. I read that it was possible to put the code in a template, and then just register the template in a PHP block. I'm there, but how to I access the variables in the template?
Here's my code
Created new template called 'forumhome_forumstats'
<dl>
<dt>{vb:rawphrase threads}</dt>
<dd>{vb:raw totalthreads}</dd><br />
<dt>{vb:rawphrase posts}</dt>
<dd>{vb:raw totalposts}</dd><br />
<dt>{vb:rawphrase members}</dt>
<dd>{vb:raw numbermembers}</dd><br />
<vb:if condition="$show['activemembers']">
<dt>{vb:rawphrase active_members}</dt>
<dd>{vb:raw activemembers}</dd>
</vb:if>
</dl>
Created new PHP block
$templater = vB_Template::create('forumhome_forumstats');
$output = $templater->render();
return $output;
As expected it will display the HTML properly, but not the template variables. How can I access them? I'm new to using the $templater and am a bit stuck.
Thank you
Here's my code
Created new template called 'forumhome_forumstats'
<dl>
<dt>{vb:rawphrase threads}</dt>
<dd>{vb:raw totalthreads}</dd><br />
<dt>{vb:rawphrase posts}</dt>
<dd>{vb:raw totalposts}</dd><br />
<dt>{vb:rawphrase members}</dt>
<dd>{vb:raw numbermembers}</dd><br />
<vb:if condition="$show['activemembers']">
<dt>{vb:rawphrase active_members}</dt>
<dd>{vb:raw activemembers}</dd>
</vb:if>
</dl>
Created new PHP block
$templater = vB_Template::create('forumhome_forumstats');
$output = $templater->render();
return $output;
As expected it will display the HTML properly, but not the template variables. How can I access them? I'm new to using the $templater and am a bit stuck.
Thank you