The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Please help - using custom variables in template
Hi,
I'm now at wits end and despite reading the tutorials/articles, I cannot figure this out. I am not new to PHP and I'm not new to developing with VBUlletin, I'm trying to port an existing mod that I created over to VB 4.x. Specifically, I have a template "newthread". I have declared a variable "$gallery_on = true;" in a plug-in that hooks into "newthread_start". In the template "newthread", I have put in the following if/else conditional: <vb:if condition="$gallery_on"> Gallery is on <vb:else /> Gallery is off </vb:if> When I go to newthread.php, the template ALWAYS evaluates $gallery_on as FALSE. WHY!?!? ARGH. Help PLEASE. I know I'm just missing something so fundamental it's ridiculous. Thanks, Leonard --------------- Added [DATE]1272649138[/DATE] at [TIME]1272649138[/TIME] --------------- OMG HOURS of trying and finally figured it out. You have to register the custom variable for use in the respective template. Code:
vB_Template::preRegister('newthread', array('gallery_on' => $gallery_on)); |
#2
|
|||
|
|||
Glad you figured it out Leonard. We had about 5 years worth of material on vB 3.x.x so it was very easy finding things, vB 4 is very new and it will take time to build up a solid knowledge base.
This guide is where some of the info is: https://vborg.vbsupport.ru/showthread.php?t=228078 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|