The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Getting foruminfo and bbuserinfo into the header template?
So I have my random header mod:
https://vborg.vbsupport.ru/showthread.php?t=212351 However, it doesn't work in VB4 because of the new template registration system. It looks like you can't call any of the foruminfo or bbuserinfo variables in the header. Is there any way I would be able to pull this info into the header, without having to do some php file editing? Maybe with some hooks? |
#2
|
||||
|
||||
Have you looked at the header template? bbuserinfo is used several times in there, so I'm not sure why you would say you can't use it. You will probably have to preregister a forumid variable to use - see this article on that: [vB4] Rendering templates and registering variables - a short guide
|
#3
|
|||
|
|||
I got bbuserinfo working, but I can't get foruminfo working.
Is there any way I would be able to pull this info into the header, without having to do some php file editing? Maybe with some hooks? |
#4
|
||||
|
||||
Did you read that article? Yes, you may use a hook to preregister the variable.
|
#5
|
|||
|
|||
Of course I read the article, I read it weeks ago. It doesn't actually help me at this point as it doesn't answer my question. The article tells me how to render variables and templates in my own custom mods. It doesn't tell me how to use it in plugins.
What hook should I be using? What code should be in the plugin? |
#6
|
||||
|
||||
No article is going to tell you what hook location to use. Go into debug mode and look at the list on the bottom of the page and use one of those. Better yet, find the area in the code you are need to target (in this case, your target is prior to the rendering of the header template, so find where it is rendered) and look for a hook that is rendered before that. And that article gives you an example of the code to preregister your variable right near the end:
Save into an array and preregister to use in an existing/stock template PHP Code:
|
#7
|
|||
|
|||
Yeah, but that code just doesn't work for me... I tried the forumdisplay_complete hook (I know that $forumid exists at that location), and couldn't get it working...
Code:
$templater = vB_Template::create('mytemplate'); $templater->register('forumid', $forumid); $templatevalues['forum'] = $templater->render(); vB_Template::preRegister('header', $templatevalues); Code:
{vb:var forum.forumid} What is "mytemplate"? Basically, what it seems like, is that I need to find a hook AFTER $forumid has been set, but before the header template has been constructed. However, if $forumid isn't set before the header template is constructed, then this whole process is pointless. Looking through forumdisplay.php, I can't find where the header is being constructed, so who knows where the hell this needs to be. If the header is the first thing constructed, then it looks like I am shit out of luck. --------------- Added [DATE]1271356345[/DATE] at [TIME]1271356345[/TIME] --------------- Well i just tried the following at forumdisplay_start: Code:
$templater = vB_Template::create('mytemplate'); $templater->register('forumid', $vbulletin->GPC['forumid']); $templatevalues['forum'] = $templater->render(); vB_Template::preRegister('header', $templatevalues); Code:
{vb:var forum.foruminfo.forumid} --------------- Added [DATE]1271356919[/DATE] at [TIME]1271356919[/TIME] --------------- Honestly, looking at this whole methodology, it seems a bit messed up. It's not really a "solution", but more of a "workaround". You are creating a false template "mytemplate", which is used exactly NOWHERE in order to pass a small array. Its inefficient programming, a complete waste of resources and a demonstration of how things shouldn't be done. Its like this whole system was designed by game programmers. --------------- Added [DATE]1271357244[/DATE] at [TIME]1271357244[/TIME] --------------- Okay... it looks like my question is answered in the COMMENTS to the article, rather than the article itself... Code:
$forum= array('forumid' => $vbulletin->GPC['forumid']); vB_Template::preRegister('header',array('forum' => $forum)); |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|