Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 07-20-2011, 04:38 AM
Murtific Murtific is offline
 
Join Date: Jul 2011
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default header template

where in the WORLD is this thing......... I even tried renaming it and it looks like it got "recreated" if it wasn't there.

I was trying to get the {vb:raw header} thingy so I could make my own custom header... I really really really want to do my own custom header. I REALLY dont want to go into each template on the dang thing and remove {vb:raw header} and replace with the WHOLE entire "header template code"... That's the only way i can get my customizations in the header to appear anywhere on the board.. That's what I did for FORUMHOME template and it works fine only on the main page
Reply With Quote
  #2  
Old 07-20-2011, 10:41 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It should just be the header template - are you sure you're editing the right one for the style you're using?
Reply With Quote
  #3  
Old 07-20-2011, 01:48 PM
Murtific Murtific is offline
 
Join Date: Jul 2011
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol.. ok answer me this then. How do you make your own custom header and still able to use {vb:raw mycustomheader} so the header shows up in templates.
Reply With Quote
  #4  
Old 07-20-2011, 02:03 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You lost me...maybe. I'm not sure why 'lol', did I answer the wrong question? If you want to make a custom header you should just be able to edit the header template.

I was about to answer the above question about using {vb:raw mycustomheader} by refering you to the article on templates, but I see you found that already. BirdOfPrey5 asked what hook you used for your plugin - that's a good question because the header is rendered kind of early on, so if you don't choose a hook before that then you won't see anything. ETA: hook parse_templates is just before where the header template is rendered, so that might be a good one.

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

OK, I saw what you posted in the other thread, and I guess you're not using plugins.

Instead, create a plugin in the adminCP by going to Plugins & Products -> Add New Plugin. Select hook location parse_templates from the dropdown and paste your code in the box. Put a title in so you'll remember what this does, and select the "Yes" radio button to enable the plugin (you should be able to leave the other fields as they are). ETA...oh yeah, and then press "Save" or "Save and Reload".

BTW, what I posted about it being too late to affect the header after global.php was wrong (I was thinking vb3), but you still want to use a plugin so that you don't have to change the php for every page.
Reply With Quote
  #5  
Old 07-20-2011, 04:01 PM
Murtific Murtific is offline
 
Join Date: Jul 2011
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
//apth_p.php has my connection info
require_once("apth_p.php");
if(!$connection) {
die("Database connection failed:: connection: " . mysql_error());
}
$db_select = mysql_select_db("Tim", $connection);
if (!$db_select) {
die("Database selection failed to select: " . mysql_error());
}
$eventlist = mysql_query("SELECT * FROM thread WHERE forumid = 8 ORDER BY dateline DESC", $connection);
if (!$eventlist) {
die("Database selection failedquery:eventlist: " . mysql_error());
}
while ($row = mysql_fetch_array($eventlist)) {
$zthreadid .= $row["threadid"];
$zdateline .= $row["dateline"]."<br />";
$zlink .= "<a href='showthread.php?{$row["threadid"]}'>" . $row["title"]."</a>" . "<br />";

}

mysql_close($connection);

$templater->register('zlink', $zlink);
$templater->register('zthreadid', $zthreadid);
$templater->register('zdateline', $zdateline);
It blanks out my forum.php page. I want to use the variables in my header
Reply With Quote
  #6  
Old 07-20-2011, 04:35 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the code you just posted, you're never initializing $templater. So you either want to go back to the code you had (using a 'threads' template), or else use preRegister like:

PHP Code:
vB_Template::preRegister('header',array('zlink' => $zlink,
                                        
'zthreadid' => $zthreadid
                                        
'zdateline' => $zdateline)); 

then use {vb:raw zlink} etc in the header template.
Reply With Quote
  #7  
Old 07-20-2011, 04:37 PM
Murtific Murtific is offline
 
Join Date: Jul 2011
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

elaborate on initializing $templater?
i added that and still doesn't work.

white page.

closest i had was, but it looked all jacked up
$templater = vB_Template::create('header');

it displayed some data but forum looked jacked up
Reply With Quote
  #8  
Old 07-20-2011, 04:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Murtific View Post
elaborate on initializing $templater?
In the code you originally posted in the article thread you had:

PHP Code:
$templater vB_Template::create('threads');
$templater->register('zthreadid'$zthreadid);
$templater->register('zlink'$zlink);
$templater->register('zdateline'$zdateline);
$zlink2['$zlink'] = $templater->render();
vB_Template::preRegister('header',array('zlink2' => $zlink2)); 
so you can see that the first line is creating a vB_Template object. In the code above you don't have that line but you're still using $templater as if it were set to an object.

Quote:
i added that and still doesn't work.

white page.
A white page usually means there's some error in the code (I suppose that's obvious), but it's hard to debug code just by looking at part of it. I don't see anything wrong with what you posted (maybe someone else will).

Are you using a plugin or still working in forum.php?
Reply With Quote
  #9  
Old 07-20-2011, 04:48 PM
Murtific Murtific is offline
 
Join Date: Jul 2011
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LOL looks like i had it all along.... dunno what i did wrong the first time tho. it works now like a champ. probably the hook....... thanks man!

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

works, but now all my external php page database stuff is all messed up

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

There has to be another method than parse_template hook. this hook just screws up all my coding for the forum. No doubt this does work. But it really is nasty to the rest of the board.

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

i had my database code in the header plugin i made closing the database connection.. that was the fault. so before my other pages opend up to call up database info, it would fail..
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 07:00 AM.


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.04165 seconds
  • Memory Usage 2,247KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete