PDA

View Full Version : Showing variable from template:headinclude from hook:global_start


ThorstenA
16 Nov 2009, 13:11
How can I show up a variable in template headinclude from the plugin global_start? I do not have created any custom template like my_custom_template shown in the code. Please advice me how can I put the variable $car in headinclude. Thanks!

plugin global start
$car ='Porsche';
$templater = vB_Template::create('my_custom_template');
$templater->register('car', $car);
$car = $templater->render();

template: headinclude
(...)
{vb:raw car}
(...)


Why doesn't it work? Thanks!

Shadab
16 Nov 2009, 13:46
Try this in the plugin:

$car = 'Porsche';

vB_Template::preRegister('headinclude', array('car' => $car));

ThorstenA
16 Nov 2009, 13:49
That works great!!! Thank you very much!

Shadab
16 Nov 2009, 13:56
You're welcome. :)