vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   Calling new template / template variables (https://vborg.vbsupport.ru/showthread.php?t=318628)

Replicant 05-11-2015 01:29 PM

Calling new template / template variables
 
1 Attachment(s)
My most recent mod to my site is a split postbit. I saw it on ozzmods.com and just had to have it. I have it fully functional but I'm not fully satisfied with how I had to implement it. At first I had created a new template with all my code and called that template with {vb:template my_template} in the thread_header template. I had var dumps in the code and the variables werent being passed along to the new template. It wasn't working. I pasted all the code into the thread_header template and it worked perfectly. So, long story short,

Are the template variables local to each template?
Do I have to call the same {vb:data whatever ..... } code in each template?

delicjous 05-12-2015 03:03 PM

Don't know for sure, but I think you have to.
Because you could call the same data a lot of times at one site but if you try to call it a second time in one template it doesnt work(ed for me last time I tried).

I was try to call a {vb:data user,...} a second time to make in one template to make two different <vb:each...>

Doesn't work... but I did not try to force it.

Dead Eddie 05-12-2015 09:40 PM

You need to explicitly pass data from one template to another.

There should be plenty of examples in the code if you perform a search for vb:template to see the syntax. Don't have my vb5 install anymore to check.

Replicant 05-13-2015 12:36 AM

Just so I'm sure I understand it and anyone else that reads this does too, in the example
Code:

{vb:template r-postbit, conversation={vb:raw conversation}}
I'm in the display_contenttype_threadview_header template. I'm calling my custom template r-postbit and the array conversation is passed along to that template? If that's correct, then I feel pretty dumb because I didn't put 2 and 2 together to figure that out.


All times are GMT. The time now is 12:38 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.00977 seconds
  • Memory Usage 1,710KB
  • 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
  • (4)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