The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Whats Called Template Hook - Under the Navbar?
Hello Everyone,
I am making a product for vBulletin 4.2 and I have tried everything to add my Item under the NAVBAR. I am not much familiar with the Navbar and Navtab hooks, but I gave it a try... Just like showen in the Picture below: Like showen on the Image, I know thats not below the HEADER, so I was thinking more about the NAVBAR and NAVTAB.. But this is where I want my item to show up like in the image. It does not show up there, but it does show on other hooks and spots! I wanted to know if I am missing something, Below is some ofl the hooks I tried.. The 2 Hooks below didn't even show the image: Code:
{vb:raw template_hook.navbar_start} {vb:raw template_hook.navbar_end} Thes 2 Hooks did show the image, but not where I wanted them: Code:
{vb:raw template_hook.navtab_start} {vb:raw template_hook.navtab_end} Thanks you very much in Advance, Regards CM So far this is the full Navbar & Navtab Hooks list for vB4 that I got: Code:
{vb:raw template_hook.navtab_start} {vb:raw template_hook.navbar_start} {vb:raw template_hook.navbar_after_getnew} {vb:raw template_hook.navbar_after_pm} {vb:raw template_hook.navbar_after_faq} {vb:raw template_hook.navbar_after_calendar} {vb:raw template_hook.navbar_community_menu_start} {vb:raw template_hook.navbar_community_menu_end} {vb:raw template_hook.navbar_after_community} {vb:raw template_hook.navbar_quick_links_menu_pos1} {vb:raw template_hook.navbar_quick_links_menu_pos2} {vb:raw template_hook.navbar_quick_links_menu_pos3} {vb:raw template_hook.navbar_quick_links_menu_pos4} {vb:raw template_hook.navbar_end} {vb:raw template_hook.navbar_start} {vb:raw template_hook.navbar_after_getnew} {vb:raw template_hook.navbar_after_pm} {vb:raw template_hook.navbar_after_faq} {vb:raw template_hook.navbar_after_calendar} {vb:raw template_hook.navbar_community_menu_start} {vb:raw template_hook.navbar_community_menu_end} {vb:raw template_hook.navbar_after_community} {vb:raw template_hook.navbar_quick_links_menu_pos1} {vb:raw template_hook.navbar_quick_links_menu_pos2} {vb:raw template_hook.navbar_quick_links_menu_pos3} {vb:raw template_hook.navbar_quick_links_menu_pos4} {vb:raw template_hook.navbar_end} {vb:raw template_hook.navtab_middle} {vb:raw template_hook.navbar_getnew_menu} {vb:raw template_hook.navbar_getdaily_menu} {vb:raw template_hook.navtab_end} |
#2
|
|||
|
|||
how are you adding content
personally i would use a plugin $template_hook[navbar_end] .= 'content here'; you will also need to state Hook Location |
#3
|
|||
|
|||
Thanks for Reply Simon:
Its a XML Product but its very long code and have 2 Template codes inside, but I have only had problems with the HOOKs, rest is going fine,, I am not good in PHP and this is why I always go STOP, Below is my the Hook code.. I suspecting the forumhome_start to be wrong which I actually just found out after so many hours.. still dont know if that could be the case.. and by the way, I use "cache templates" and not the "process templates" which may also indicate that it could be why! Code:
<plugin active="1" executionorder="5"> <title>Popup Navbar Image</title> <hookname>forumhome_start</hookname> <phpcode><![CDATA[global $vbulletin; if ($vbulletin->options['navbar_image']) { $templater = vB_Template::create('navbar_image'); $template_hook['navbar_end'] .= $templater->render(); }]]></phpcode> |
#4
|
|||
|
|||
Try using hook parse_templates, and if you only want it on the home page check for THIS_SCRIPT == 'index'.
|
#5
|
|||
|
|||
Quote:
Code:
<plugin active="1" executionorder="5"> <title>Cache Additional Notification Templates</title> <hookname>cache_templates</hookname> <phpcode><![CDATA[$cache = array_merge((array)$cache,array( 'navbar_image', ));]]></phpcode> </plugin> Now I am thinking to use the Replace code instead of hooks, I never found out how to Replace a code on vB4.2, but on my vB3.8 it was a success when I saw one of your and Scanus explanation!, But I keep failing using the Replace code on vB4.x.. Thats why I am only use hooks now :/ I have 2 different Replace codes, but didnt work on vB4.2, Can you please show how can I replace this instead of using the hooks... Thank you Method 1: Code:
$replace = 'REPLACE CODE'; $vbulletin->templatecache['navbar'] = str_replace($replace,'REPLACE CODE'.$replace,$vbulletin->templatecache['postbit']); Code:
$replace = 'REPLACE CODE'; $vbulletin->templatecache['navbar'] = str_replace($replace,$replace.'REPLACE CODE',$vbulletin->templatecache['postbit']); Code:
<div class="body_wrapper"> {vb:raw ad_location.ad_navbar_below} {vb:raw ad_location.global_below_navbar} <vb:if condition="$show['notices'] AND THIS_SCRIPT != 'register'"> <form action="profile.php?do=dismissnotice" method="post" id="notices" class="notices"> <input type="hidden" name="do" value="dismissnotice" /> <input type="hidden" name="s" value="{vb:raw session.sessionurl}" /> <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" /> <input type="hidden" id="dismiss_notice_hidden" name="dismiss_noticeid" value="" /> <input type="hidden" name="url" value="{vb:raw return_link}" /> <ol> {vb:raw notices} </ol> </form> </vb:if> |
#6
|
|||
|
|||
Doing replaces in templates is a little more difficult with vb4 because what's stored in the cache is php code, so you have to make sure it's still valid php code after the replace. It still may be possible to do a replace like you would do in vb3, it depends on exactly what you're trying to replace. It might help to look at the "template" column in the template table in the database, or print out what's in the cache so you can figure out exactly what you need to do.
If I remember correctly the "REPLACE CODE' thing was solving a special problem, so you probably dont' need to do it that way. Did you try using hook parse_templates? You mentioned process_templates, and I think there is a process_template_complete hook but it's called after the navbar is rendered so changing the cache at that point won't help. OK, I just read the last part of your post above: If you just want to add something to the end of the navbar, then instead of doing a replace you could do this: Code:
$vbulletin->templatecache['navbar'] .= "$final_rendered .= 'Add this stuff'"; But it might be a little tricky to get the quotes right. The other thing you could do is to find a hook that comes after the navbar is rendered (like process_templates_complete) and do something like: Code:
$navbar .= "Add this stuff"; |
#7
|
|||
|
|||
So inspirational..... Thank you KH99,
I tried the first method and I got this error all the way: Parse error: syntax error, unexpected T_STRING in /home/content/93/8491993/html/vb4test1/includes/class_bootstrap.php(561) : eval()'d code on line 49 I actually used the process_templates_complete as my my hookname, I will now try the 2nd method with the $navbar only.. and a few other hooks, hopefully by tomorrow I can possibly answer back on it and If I cant figure it out, Else I might add my whole Template code, so you can see the exact "Render" and "Process_Template" Codes, maybe I do it totally wrong.. Thanks a Lot buddy, I will def save your info, hopefully I can always use it no matter how many times I fail to finish my work.. --------------- Added [DATE]1351879808[/DATE] at [TIME]1351879808[/TIME] --------------- Hi Kh99, I totally failed doing the Product, I get the parse error all the time. Parse error: syntax error, unexpected T_STRING in /home/content/93/8491993/html/vb4test1/includes/class_bootstrap.php(561) : eval()'d code on line 49 I will try pm you with my product, hopefully you will take a look and tell me how the replace works, and if you could fix it for me then I would be more than greatfull Thanks a lot kh99 for your help mate.. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|