Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-05-2009, 04:30 AM
Cedric_FP Cedric_FP is offline
 
Join Date: May 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Including one template in another

Hello,

I have made a custom template and want to include it at the top of my header template for ease, so when I update the reverts don't remove my code.

If the custom template is called "HEADERLOGINBOX" how could I call it at the start of my standard header template?

I've tried $HEADERLOGINBOX but that doesn't work.

Thanks for your help.
Reply With Quote
  #2  
Old 10-05-2009, 04:40 AM
ChopSuey ChopSuey is offline
 
Join Date: Jun 2009
Location: Alaska
Posts: 2,140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cant you just take the login box from the navbar template and use it in the header?
Reply With Quote
  #3  
Old 10-05-2009, 04:47 AM
Cedric_FP Cedric_FP is offline
 
Join Date: May 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ChopSuey View Post
Cant you just take the login box from the navbar template and use it in the header?
No. I need to do it this way because I have completely customized the header.

What i want to do is include my custom template inside the header so that when I update, the reverts don't mess everything up.

The login box in the navbar template actually has nothing to do with my custom header.
Reply With Quote
  #4  
Old 10-05-2009, 05:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to eval your template in a plugin so the variable is available for use.

PHP Code:
eval('$yourvariable .= " ' fetch_template('your_template') . '";'); 
Reply With Quote
  #5  
Old 10-06-2009, 09:40 PM
Cedric_FP Cedric_FP is offline
 
Join Date: May 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne. Will give that a shot tonight

Where would I hook it? Header_redirect?
Reply With Quote
  #6  
Old 10-07-2009, 12:37 AM
ZeepySea ZeepySea is offline
 
Join Date: Aug 2007
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't need to hook it, just call it where you want in the style.

As Lynne showed, replace $yourvariable with $headerloginbox calling the template you created in place of your_template. You'll need to add that eval to a page somewhere.

Then in the header template place the $headerloginbox where you would like.
Reply With Quote
  #7  
Old 10-07-2009, 10:35 AM
Cedric_FP Cedric_FP is offline
 
Join Date: May 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ZeepySea View Post
Don't need to hook it, just call it where you want in the style.

As Lynne showed, replace $yourvariable with $headerloginbox calling the template you created in place of your_template. You'll need to add that eval to a page somewhere.

Then in the header template place the $headerloginbox where you would like.
I'm sorry but I don't understand what you mean by adding the eval to a page?
Reply With Quote
  #8  
Old 10-07-2009, 02:31 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It sounds to me like the OP does need to use a plugin since this is not on a custom page, but on every page. And, since you want it included in the header, you'll have to use a very early hook location like a global_* one (global_start?). So, try that.
Reply With Quote
  #9  
Old 10-07-2009, 07:51 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The way to do this is to look at what php page you are loading.
So it depends where you want to insert the template.

Let's say you want to insert a template on a thread's page somewhere in the SHOWTHREAD template.
So you would be looking at the thread with the showthread.php file.
This is the file that you have to scan for hooks.
Open it in a text editor and check what hooks are in the php file and where they are located.
Often, there is a hook at the end which is safe to hook into (in this case 'showthread_complete').

Then you do as suggested above. Go to the plugins. Create a plugin for the hook you just found. Eval the template in that hook and use the variable in the showthread template.
Reply With Quote
  #10  
Old 10-08-2009, 01:18 AM
Cedric_FP Cedric_FP is offline
 
Join Date: May 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
It sounds to me like the OP does need to use a plugin since this is not on a custom page, but on every page. And, since you want it included in the header, you'll have to use a very early hook location like a global_* one (global_start?). So, try that.
I see. I'll give that a shot as I do want it in the header, and therefore to appear on every page.

Quote:
Originally Posted by squishi View Post
The way to do this is to look at what php page you are loading.
So it depends where you want to insert the template.

Let's say you want to insert a template on a thread's page somewhere in the SHOWTHREAD template.
So you would be looking at the thread with the showthread.php file.
This is the file that you have to scan for hooks.
Open it in a text editor and check what hooks are in the php file and where they are located.
Often, there is a hook at the end which is safe to hook into (in this case 'showthread_complete').

Then you do as suggested above. Go to the plugins. Create a plugin for the hook you just found. Eval the template in that hook and use the variable in the showthread template.
Thanks for the input! So this method would remain roughly the same for, say, forumhome.php?

Thanks people
Reply With Quote
Reply


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 07:48 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.04304 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete