Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Design and Graphics Discussions
  #1  
Old 07-24-2007, 04:24 PM
okgaz okgaz is offline
 
Join Date: Jun 2007
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default I added a new template but how do I use it?

Hi,

I made a new template from my admin panel + I want to include it in my header. All the other templates seem to be included in one another just by adding "$templatename" but it doesn't work for the one I created. Do I need to do something to assign a "$name" to it?

Thanks!

-Gaz
Reply With Quote
  #2  
Old 07-24-2007, 05:10 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'll need to do these things:
1) Create your template, templatename, which you've already done and
2) Create 2 plugins
Go to your admincp => Plugins & Products => Add New Plugin =>

Plugin 1
Product - vbulletin
Hook Location - cache_templates
Title - Title of Plugin 1
Plugin PHP Code -
Code:
$globaltemplates[] = 'templatename';
and

Plugin 2
Product - vbulletin
Hook Location - global_start
Title - Title of Plugin 2
Plugin PHP Code
Code:
global $db, $vbulletin;
eval('$templatename .= "' . fetch_template('templatename') . '";');
Reply With Quote
  #3  
Old 07-24-2007, 05:40 PM
okgaz okgaz is offline
 
Join Date: Jun 2007
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi David. Thanks for your help!

Using your method it now shows up on the forum pages.

It is my ibproarcade pages I want it show up on though + it doesn't seem to work on those. Do you know of anything I can do to fix that?

-Gaz
Reply With Quote
  #4  
Old 07-24-2007, 05:42 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may need to request help under that modification's support forum.
Reply With Quote
  #5  
Old 07-25-2007, 03:14 AM
funrun funrun is offline
 
Join Date: Jul 2007
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

David, your plugin advice got my added template to show up too, yet created an odd problem that I'm stuck on. What I did was literally cut a section of code (my custom navbar) that I had duplicated in the SHOWTHREADS, FORUMDISPLAY, etc templates and pasted it into a new added template called navbar_forums. I then referenced $navbar_forums in the aforementioned default templates and used your plugin code to get it to show up.

However, not all the cut and pasted code evaluates correctly through the $ reference, but if I remove the $ reference and paste the same code chunk directly back into SHOWTHREAD, it all works correctly.

The problem seems to be that this <if> statement does not evaluate properly regardless of whether I use a browser with or without popups (I test in multiple browsers)
Code:
<if condition="$show['popups']">
All the proper end tags and format is included. Dreamweaver thinks so too. So I thought perhaps it was an issue with $show, yet these other <if> statements in the same code chunk evaluate properly when I'm logged in or out
Code:
 <if condition="$show['member']">
            <if condition="$show['quicksearch']">

So how does a code chunk parse correctly, except when included through a new added template? Could this issue have something to do with the plugin code? Any other ideas?
Reply With Quote
  #6  
Old 07-25-2007, 12:51 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It could possibly - I've had two hacks that both use global_start conflict with each other, depending on its contents. To test this out, if sort your plugins by hook location and find others that share global_start. Then try disabling others one at a time to see if there is a conflict.

Also, although Dreamweaver may be satisfied that all tags have ends, your total script may not start/end. When a page is displayed, it displays everything in that page inclusive of all templates. If one previous template has an unclosed tag, or one latter template does not close, then you might have issues. The same goes with the basics of html. What you see in Dreamweaver is only one section of code, which satisfies by closing all tags, as you state. That is just something to keep in mind. (I've run into this upon occasion when building non-vbulletin websites completely from scratch)

Also, keep in mind, that although the code may satisfy tag closure, the code itself may have an issue within itself or with something else it is being used with.

If you want, PM me the code or paste it here and I will try to look at it later.
Reply With Quote
  #7  
Old 07-26-2007, 02:23 AM
funrun funrun is offline
 
Join Date: Jul 2007
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No other plugins are using global_start, but my Downloads plugin was using cache_templates. I disabled that one, emptied my browser cache, but it made no difference.

I understand the idea that another template may not open or close properly, but in my tests I replace the template "$reference" with all of the code from the actual referenced template. In theory the same code gets exported in the end, so any improperly opened or closed tags in the rest of the page should have the same affects, no?

I feel like I can't explain without a short, fake example (because my actual code is very long):

If SHOWTHREADS contains:
Code:
<p>Unclosed p tag here
$navbar_forums
<p>hello world</p>
where the template "navbar_forums" contains this code:
Code:
<p>this is the new template</p>
Then the combined codes above ultimate displays in the browser such as:
Code:
Unclosed p tag here

this is the new template

hello world
Or

If I just wrote SHOWTHREADS as:
Code:
<p>Unclosed p tag here
<p>this is the new template</p>
<p>hello world</p>
It should still output exactly the same way in the browser, correct?
Reply With Quote
  #8  
Old 07-26-2007, 02:29 AM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you calling another template within the custom template? If so, that will most likely not work (I've spent a couple hours working on an 7-day ad rotation hack that had similar issues).
Reply With Quote
  #9  
Old 12-17-2010, 09:34 PM
M.C. M.C. is offline
 
Join Date: Jan 2002
Posts: 463
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by davidw View Post
You'll need to do these things:
1) Create your template, templatename, which you've already done and
2) Create 2 plugins
Go to your admincp => Plugins & Products => Add New Plugin =>

Plugin 1
Product - vbulletin
Hook Location - cache_templates
Title - Title of Plugin 1
Plugin PHP Code -
Code:
$globaltemplates[] = 'templatename';
and

Plugin 2
Product - vbulletin
Hook Location - global_start
Title - Title of Plugin 2
Plugin PHP Code
Code:
global $db, $vbulletin;
eval('$templatename .= "' . fetch_template('templatename') . '";');
tried to do it but with no luck my template not fetch in header... any suggestions?
Reply With Quote
  #10  
Old 12-19-2010, 09:08 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by M.C. View Post
tried to do it but with no luck my template not fetch in header... any suggestions?
You bumped a very old thread, are you using VB4? If so this won't work with VB4 so I suggest asking for help (or better yet searching) the 4.x forum.

If you do have 3.x are you getting any error at all? Are you double sure your plugins were set to ACTIVE (YES)?
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 06:13 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08732 seconds
  • Memory Usage 2,260KB
  • 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
  • (10)bbcode_code
  • (2)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