vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   A little confused now (calling a template) (https://vborg.vbsupport.ru/showthread.php?t=227892)

HMBeaty 11-14-2009 12:18 AM

A little confused now (calling a template)
 
Just got vBulletin 4.0.0 Suite set up on my test site for now, trying to get all of my modifications working before I install it on my live site. So, for those of you who have already had the time to play around with vB 4, how do you call templates now.

I USED to do it like in this thread by using the method below
PHP Code:

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

but that apparently no longer works.

So, anyone know how to call a template via a plugin now? haha
(vBulletin 4.0.0 is definately a lot more confusing than I thought it'd be)

Lynne 11-14-2009 04:56 AM

First, you need to register the variables you will be using in the template and then you need to render it.
Example from one of mine using a template_hook:
PHP Code:

    $templater vB_Template::create('my_custom_template'); 
        
$templater->register('a_variable '$a_variable); 
    
$template_hook['some_hook'] .= $templater->render(); 

or - using a variable (which must then be registered for us in the next template):
PHP Code:

    $templater vB_Template::create('my_custom_template'); 
        
$templater->register('a_variable '$a_variable);
    
$somevariable .= $templater->render(); 

or - print_output:
PHP Code:

    $templater vB_Template::create('my_custom_template'); 
        
$templater->register('a_variable '$a_variable);
    
print_output($templater->render()); 

There is a blog entry by Kier over on vb.com that shows this.

Yellow Slider 11-15-2009 05:41 PM

Hey, thank you for your reply.
Can you please be more specific?
What shout i put instead of a_variable, $tagforms, $template_hook['some_hook'], etc?
What should be the hook location?

TheLastSuperman 11-15-2009 06:11 PM

Quote:

Originally Posted by Yellow Slider (Post 1914719)
Hey, thank you for your reply.
Can you please be more specific?
What shout i put instead of a_variable, $tagforms, $template_hook['some_hook'], etc?
What should be the hook location?

See it uses { & } now for some things and the vb: is now in all your templates.

Code:

<img src="{vb:stylevar imgdir_misc}/paperclip.png" class="inlineimg" />
&

Code:

{vb:raw template_hook.postbit_signature_end}
Are some examples, check your templates you'll see codes there and tinker with it, very easy to catch on ;) and your template "postbit signature end" is being called via that code which was located in the postbit template :D.

Lynne 11-15-2009 06:21 PM

a_variable is the name of the variable you are registering. $tagforms was supposed to be $a_variable, but I forgot to change it - it is now changed. As for the $template_hook, that would be the name of the template_hook you are trying to use.... if you are using a template_hook. I gave several examples up there - you would not use them all for one template call.

Omegatron 11-15-2009 10:09 PM

How about if the hook you want does not exist. In vb3 say for instance after navbar you could print a blook right about the forumbits below the navbar. There is no such hook in vb4

http://www.vbulletin.com/forum/showt...on-for-plugins

Lynne 11-15-2009 10:28 PM

Then either add your own hook or modify the template manually.

Omegatron 11-15-2009 10:44 PM

Are there tutorials on adding your own hook location?

--------------- Added [DATE]1258332480[/DATE] at [TIME]1258332480[/TIME] ---------------

Nevermind got it but still would have not liked to hard code something into forumhome if I did not have to ;)

Lynne 11-15-2009 10:52 PM

I think I just responded to a thread you made on vb.com. Until they add a hook under the navbar on FORUMHOME, you can just do a str_replace on <div id="pagetitle">

Omegatron 11-15-2009 11:11 PM

yeah you did I tried the str_replace and it did not work I asked if you knew why it did not.


All times are GMT. The time now is 06:56 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.01161 seconds
  • Memory Usage 1,747KB
  • 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
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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