vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Calling other templates (https://vborg.vbsupport.ru/showthread.php?t=250554)

dvsDave 09-15-2010 12:21 PM

Calling other templates
 
Is there a way to call other templates?

Basically, is there a way to do this:
Code:

<vb:if condition="$bbuserinfo[fieldx] != 'Vertical'">

vb:template postbit;

<vb:else />

vb:template postbit_legacy;

</vb:if>


compwhizii 09-15-2010 12:31 PM

No, you have to do that in your code.

dvsDave 09-15-2010 12:55 PM

In the GENERIC_SHELL template, they call certain templates

Code:

        {vb:raw headinclude}
        <title>{vb:raw pagetitle}</title>

        <vb:if condition="$includecss">
                <vb:if condition="$vboptions['storecssasfile']">
                        <vb:each from="includecss" value="file">
                                {vb:cssfile {vb:raw file}}
                        </vb:each>
                <vb:else />
                        {vb:cssfile {vb:raw includecss}}
                </vb:if>
        </vb:if>
        {vb:raw headinclude_bottom}

Does that only work for some templates, or can I reuse this format to insert the template of my choice?

Lynne 09-15-2010 01:54 PM

It works if you have already rendered the template and then you need to register the variables for use in that template (it is actually calling a variable with the same name as a template, not calling a template).

dvsDave 09-15-2010 02:09 PM

My thought is to copy the postbit to a new template called postbit2, then put the above code in the postbit.

How can I render the two templates (postbit_legacy and postbit2), or choose which template to use then render one of them?

compwhizii 09-15-2010 02:11 PM

You need to fetch the remplate and register it in your code.

ragtek 09-16-2010 05:28 AM

Stop!!!!
Just check, how vB is handling the postbit templatess;)

It's much easier to change $vbulletin->options['legacypostbit'] !

Lynne 09-16-2010 01:38 PM

^^ What he said. That is the option that determines which postbit template gets used. So, toggle it depending on what the user has selected.

dvsDave 09-16-2010 03:13 PM

Quote:

Originally Posted by ragtek (Post 2098933)
Stop!!!!
Just check, how vB is handling the postbit templatess;)

It's much easier to change $vbulletin->options['legacypostbit'] !

That's what I was hoping to find in the first place. Unfortunately, I'm still learning the vBulletin template/coding system.

Where would I find this and how can I access the user's preferences to switch the option?

-David

Lynne 09-16-2010 05:50 PM

Did you use a User Profile Field for them to pick which to use? Just do a condition based on that field to change it for the user. Look in the showthread.php file to find a good hook. Or, if in debug mode, you can see the hook locations all listed on the bottom of the page in the order they are used. Sometimes I find myself just going down the list to see which is best.


All times are GMT. The time now is 02:42 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.01201 seconds
  • Memory Usage 1,729KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete