PDA

View Full Version : send a single variable to a vbulletin default template


White_Snake
02-24-2010, 06:08 PM
on cellarius article on vbulletin templating, he explains the way to send variables to preexisiting templates is this:

$templater = vB_Template::create('mytemplate');
$templater->register('my_var', $my_var);
$templater->register('my_array', $my_array);
$templatevalues['my_insertvar'] = $templater->render();
vB_Template::preRegister('FORUMHOME', $templatevalues);

but what when you need to only send a single variable to a existing template without the need to create a new template such as is requested on the first line?

i want to send a variable to the template editpost but this method doesnt seem to work, anybody can help me? thanks

Lynne
02-24-2010, 08:33 PM
$uid = $vbulletin->GPC['uid'];
vB_Template::preRegister('FORUMHOME', array('uid' => $uid));
Now you can use {vb:raw uid} in the FORUMHOME template

White_Snake
02-24-2010, 11:50 PM
$uid = $vbulletin->GPC['uid'];
vB_Template::preRegister('FORUMHOME', array('uid' => $uid));
Now you can use {vb:raw uid} in the FORUMHOME template

hello Lynne :)

i have tried your code and it hasnt worked, ill post what i have in here:

hook: newpost_process
$droled= "active";
$droled = $vbulletin->GPC['droled'];
vB_Template::preRegister('editpost', array('droled' => $droled));


thank you again for your time

Lynne
02-25-2010, 03:07 AM
Just
$droled= "active";
vB_Template::preRegister('editpost', array('droled' => $droled));

White_Snake
02-25-2010, 04:52 AM
Just
$droled= "active";
vB_Template::preRegister('editpost', array('droled' => $droled));

thanks you again for your answer

but its not working at all :( any other suggestion you might have? thanks!

--------------- Added 1267137287 at 1267137287 ---------------

okay i got it, i was using a wrong hook location, but now, how do i send $post[field5] value to editpost? thanks!