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 06-05-2012, 03:47 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Customised $headinclude

I am currently trying to customise my default template. I would like slightly different headers to display on the forum depending on where in the forum somebody is browsing (i.e whether they are looking at the forum listings, viewing a thread, looking at the memberlist, etc).

Therefore I will need to create slightly different headinclude versions in the template (such as headinclude2, headinclude3, headinclude4, etc) and then insert these into the relevant parts of the forum (e.g. in SHOWTHREAD section in the template calling $headinclude2 instead of the default $headinclude).

What do i need to do in order to make this work? I understand that i will need to write some sort of plugin to make these customisations available to the forum? Has anybody got any guidance as to the steps needed in this instance?

Thanks in advance
Reply With Quote
  #2  
Old 06-05-2012, 04:35 PM
ddrager ddrager is offline
 
Join Date: May 2012
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try creating a plugin which acts on global_start, and then have the code:

eval('$header2 = "' . fetch_template('header2') . '";');
eval('$header3 = "' . fetch_template('header3') . '";');

You can then name $header2, etc in the main template (SHOWTHREAD, etc) and it will call the alternate header template.
Reply With Quote
  #3  
Old 06-05-2012, 05:10 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you - this works like a dream!

If i just wanted this variable to only act on SHOWTHREAD would there be a more resourceful place to hook this into other than global_start?

Thanks.
Reply With Quote
  #4  
Old 06-05-2012, 05:14 PM
ddrager ddrager is offline
 
Join Date: May 2012
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you only want it in showthread, then I would just put it directly into the SHOWTHREAD template. No more calls, it's directly in there.

Otherwise, you may be able to create a plugin which acts on the hook showthread_start, which I think would be called just on showthread.
Reply With Quote
  #5  
Old 06-05-2012, 10:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would not use global start as it has been deprecated for a couple of years.

PHP Code:
// Deprecated as of release 4.0.2, replaced by global_bootstrap_init_start
($hook vBulletinHook::fetch_hook('global_start')) ? eval($hook) : false
Reply With Quote
  #6  
Old 06-05-2012, 10:46 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Lynne --->nudge! vb3!
Reply With Quote
Благодарность от:
Lynne
  #7  
Old 06-06-2012, 12:58 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ACK!!!!

OK, forget my post.

I will start looking at the forum title. I will start looking at the forum title. I will start looking.....
Reply With Quote
Благодарность от:
blind-eddie
  #8  
Old 06-08-2012, 01:57 PM
seanadl seanadl is offline
 
Join Date: Jan 2007
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok here's what i'm doing to simplify things.

I'm pasting my customised header into SHOWTHREAD. I'm copying the contents of headinclude and replacing the $headinclude call in SHOWTHREAD with the code which is then slightly modified.

However, some users have reported weird behaviours on the thread pages ever since doing this (things such as white screens appearing when they try to post or buttons missing in their editor toolbar). The code copied from headinclude is exactly as is with just a couple of google ad tags added to it so im' not sure why it should affect the template in such a drastic way.

Any ideas?
Reply With Quote
  #9  
Old 06-08-2012, 03:12 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ideally you should have created x amount of headinclude templates and replaced (using and IF condition and str_replace ) $headinclude with $headincludex (where x would be the defining number), you don't want to put all the headinclude code in showthread, this is beacuse the headinclude content goes in the header template, by adding it to the showthread you ar enot encapsulating it in the HEAD tags.
Reply With Quote
  #10  
Old 06-08-2012, 03:22 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's a quick product i knocked up so you can display stuff in the headinclude (you may need to go to plugins and activate the plugin as i cant remember if i did that
Attached Files
File Type: xml product-add_headinclude_content.xml (1.1 KB, 12 views)
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 01:07 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.02600 seconds
  • Memory Usage 2,278KB
  • Queries Executed 14 (?)
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
  • (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
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete