The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
RESOLVED: Calling a Variable from Plugin in VB4
I'm trying to call a variable from a plugin in a stock template. Is it necessary I render the variable in its own custom template first, then call it inside the stock template using {vb:raw $mytemplate}? I thought this seemed superfluous and wanted to be sure as I just finished reading over https://vborg.vbsupport.ru/showthread.php?t=228078 .
|
#2
|
||||
|
||||
You may call a varialbe in a stock template, however you much register it for use in that template first. If it's a stock template, then you may have to preregister it if you aren't going to use a template_hook or a variable array that is already registered.
|
#3
|
|||
|
|||
I pre-register the variables I'm using in the stock template inside the plugin itself, correct? For instance, I have an array named $array that I'm trying to use in the FORUMHOME template.
In the plugin: PHP Code:
PHP Code:
|
#4
|
||||
|
||||
I am pretty sure that $array is a reserved word and you may not use it as a variable name.
And then I think you want to do something more along this line: PHP Code:
|
#5
|
|||
|
|||
And the plugin needs to be assigned to the parse_templates hook I believe or at least the global hook wouldn't work for me.
|
#6
|
|||
|
|||
Quote:
Hm. I'm using the forumhome_start hook which is working fine for me. I'll keep that in mind though if/when I make a plugin that needs to be used on more than one template. Thanks |
#7
|
|||
|
|||
Actually you may be fine with just registering variables but I do know that when I was trying to register a custom template it wouldn't work with the global hook and I read someone's post (I think it was Lynne's) suggesting to someone else to use the parse_templates.
As long as it works for you it doesn't make a difference lol. EDIT: BTW can someone move my thread from the design froum to this one. Realized after I posted it that it should have been here. |
#8
|
||||
|
||||
Hit the Report this Post button and ask to have it moved to the xxx forum.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|