vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Duplicate Template Variables & Use It Within Another Template? (https://vborg.vbsupport.ru/showthread.php?t=159095)

Freesteyelz 09-30-2007 01:56 AM

Duplicate Template Variables & Use It Within Another Template?
 
I've read quite a bit of helpful threads/tutorials here. I know how to create a custom template and set it in plugins then call from within another template. I was wondering, however, how would I go about creating a template that uses the variables of an existing template such as "threadbit"? Example below...

I want to create a template called "threadbit_test". In it I want to copy/paste the content from "threadbit" template. I then want to use "threadbit_test" template inside "threadbit" template such as:

In threadbit template code applied:
Code:

<if condition="in_array($forumid, array(x,y,z))">
  $threadbit_test
<else />
  threadbit content here
</if>


For some reason the variables I took from threadbit template do not display in $threadbit_test? The only way (right now) I'm able to display the variables of threadbit template is to literally copy it and replace it where $threadbit_test is in the code example. It's rather cluttered.

Do I need to cache and parse the $threadbit_test template or hook it to threadbit_display or another area in the plugins such as global_start?

Your help is appreciated. :)

Dismounted 09-30-2007 06:35 AM

PHP Code:

eval('$threadbit_test = "' fetch_template('threadbit_test') . '";'); 

Hook: showthread_complete

Freesteyelz 09-30-2007 09:37 PM

Thanks for replying Dismounted. :)

I've implemented the hook in showthread_complete as described above but the $threadbit content did not display in $threadbit_test. I could be wrong but isn't $threadbit called from the forumdisplay hook?

Still, I tried forumdisplay_start and forumdisplay_complete hooks but to no avail either. Hmm...

--------------- Added at 12:45 ---------------

Update:

I changed the hook to "threadbit_display" and the content showed up. :up: The downside is that $threadbit_test added border lines that $threabit template did not. At least I'm getting closer. :)


All times are GMT. The time now is 03:00 PM.

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.01070 seconds
  • Memory Usage 1,717KB
  • 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)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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