View Full Version : Variable to Test for NAVBAR
Is there a variable you can set an IF condition to, that will determine if the NAVBAR template has been called or not.
It looks like every page that renders the navbar template assigns it to $navbar, so you might be able to use if ($navbar) in PHP code or <if condition="$navbar"> in a template.
Thanks for the lead but I tried that one and nothing.
I even tried using a NAVBAR template hook to inject a phrase to test for that however apparently that hook loads regardless of if NAVBAR is called or not.
Well, where are you trying to check? If it's in a function (or a template or a hook location that's called inside a function) then you may not have access to the global variable.
I've tried in a template and navbits/navbit_complete hooks.
Maybe I should have asked a different question - what are you trying to do? The navbar is on most pages, are you trying to detect if ou're on a certain page? There may be a better way to do that.
Certain vB pages do not call the NAVBAR. We have a page division that occurs in the NAVBAR template, then closes in the footer. If a page does not call the NAVAR, it messes the structure of the page. Therefore I need to determine in the footer, if the NAVBAR has been executed to know if I should include a variable or not.
I know I could manually do it with wrap conditions like IF SCRIPT = REGISTER, etc. but would prefer a more universal way then all these IF conditions and tracking down every script that does not call it.
Oh. I think the problem is that the footer template is actually rendered before the navbar template, so I can't really think of any way for that to work beyond checking for pages.
Maybe you could put in javascript that does a document.write of the closing tag, and in navbar put in some js to set a variable.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.