vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Please help - using custom variables in template (https://vborg.vbsupport.ru/showthread.php?t=241581)

Leonard 04-30-2010 04:24 PM

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!?!?:confused::confused:

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));
Is there no documentation for developers where all of this information lives? I'm sorry but I'm just so frustrated right now. Gosh.

NickyDee 04-30-2010 05:40 PM

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


All times are GMT. The time now is 07:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01178 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete