Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 11-14-2009, 12:18 AM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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)
Reply With Quote
  #2  
Old 11-14-2009, 04:56 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 11-15-2009, 05:41 PM
Yellow Slider Yellow Slider is offline
 
Join Date: Aug 2006
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 11-15-2009, 06:11 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Yellow Slider View Post
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 .
Reply With Quote
  #5  
Old 11-15-2009, 06:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 11-15-2009, 10:09 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 11-15-2009, 10:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then either add your own hook or modify the template manually.
Reply With Quote
  #8  
Old 11-15-2009, 10:44 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 11-15-2009, 10:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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">
Reply With Quote
  #10  
Old 11-15-2009, 11:11 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:39 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.04122 seconds
  • Memory Usage 2,257KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete