The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Why can't I preregister a template variable in a function?
I got started on a project to make the What's Going On box available on pages other than the home page. The way I wanted to do it is shown schematically below:
Code:
function whats_going_on($template_name) { global $vbulletin, $show, $template_hook, $vbphrase; . . . $templater = vB_Template::create('whatsgoingon'); . $preregistered['whatsgoingon'] = $templater->render(); vB_Template::preRegister($template_name, $preregistered); } whats_going_on('FORUMDISPLAY'); Code:
function whats_going_on() { global $vbulletin, $show, $template_hook, $vbphrase; . . . $templater = vB_Template::create('whatsgoingon'); . return $templater->render(); } $preregistered['whatsgoingon'] = whats_going_on(); vB_Template::preRegister('FORUMDISPLAY', $preregistered); |
#2
|
|||
|
|||
I tested it out and for me it seems to work either way.
|
#3
|
|||
|
|||
What hook location were you using?
|
#4
|
|||
|
|||
Well, forumhome_start, because I originally got confused between forumdisplay and forumhome and couldn't get it to work either way. Then when I figured that out I just decided to change everything to FORUMHOME. So I suppose I could try with FORUMDISPLAY in case that makes a difference.
Edit: no, it still works both ways, using FORUMDISPLAY and hook forumdisplay_start. |
#5
|
|||
|
|||
If it's a Works-for-Peter-but-not-for-Paul situation I guess I better use what I have. I'm just tossing this product out for whoever wants to play with it and I don't want to have to help people write special code to get it going.
Thanks for testing it. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|