Quote:
Originally Posted by Lynne
First, you need to register the variables you will be using in the template and then you need to render it.
Example from one of mine using a template_hook:
PHP Code:
$templater = vB_Template::create('my_custom_template');
$templater->register('a_variable ', $a_variable);
$template_hook['some_hook'] .= $templater->render();
or - using a variable (which must then be registered for us in the next template):
PHP Code:
$templater = vB_Template::create('my_custom_template');
$templater->register('a_variable ', $a_variable);
$somevariable .= $templater->render();
or - print_output:
PHP Code:
$templater = vB_Template::create('my_custom_template');
$templater->register('a_variable ', $a_variable);
print_output($templater->render());
There is a blog entry by Kier over on vb.com that shows this.
|
I'm not a coder or anything, but I do require certain small plugins that would most likely be only useful for me. I have played with these examples, as well as ones previously provided on vBulletin.com, but have failed to wrap my head around how it is actually supposed to work. In my case, I simply need to be able to use a custom variable containing data in templates. One simple example of this would be as follows:
PHP Code:
$random_number = rand(1, 105);
How exactly should the plugin be formulated to make the variable $random_number accessible in the header template?