The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Setting a condition in a static CMS page to display correct sub-menu
I've created a new Navbar tab named Software using a Plugin and a static page that displays (correctly) when I click on that tab. There is also a sub-menu that will display if it finds the string define('THIS_SCRIPT', 'software_navtab'); in the static page. Somehow, I need to embed this string into the php file, but I don't know how to do that since it is created as content.
I posted this at vbulletin.com and was told that it should be posted here, but I was told that I shouldn't use THIS_SCRIPT for this process. What would be an alternate way of setting or determining a condition that would be recognized by the Plugin? |
#2
|
|||
|
|||
So if I understand correctly you want a sub menu to appear in certain circumstances - is it always exactly when your new "Software" tab is selected, or does it actually depend on the contents of the page?
Edit: also, how exactly did you add the static page? What's the url you use for your software tab? Edit: oh, I see now you actually mean a CMS static page. Anyway, maybe someone else will be able to answer with the info you've already given. |
#3
|
|||
|
|||
I want the Software sub-menu to display whenever the software_page or other static pages linked below appear. I believe I can do this by embedding the THIS_SCRIPT statement into each of the linked php files.
Here is my plugin (the links are un-populated at this time), using the Hook location process_templates_complete: $tablinks = ''; if (THIS_SCRIPT == 'software_navtab') { $vbulletin->options['selectednavtab']='navtab_software'; $tabselected = ' class="selected"'; $tablinks = ' <ul class="floatcontainer"> <li><a href="link1.php">Link 1</a></li> <li><a href="link2.php">Link 2</a></li> <li><a href="link3.php">Link 3</a></li> </ul> '; } $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?124-software_page">Software</a>'.$tablinks.'</li>' ; I created the page by simply clicking the Create <static page> button from CMS which gave it the name: content.php?124-software_page. So even though it says it is a static page, it appears to be dynamic and doesn't exist as a php file I can modify. Should I be creating this page differently - Dreamweaver, for example? I know that I can then embed php codes into the file. If so, I assume that I'll need to also embed the Header and Footer code to maintain visual consistency. Perhaps I'm going about this all wrong - I was not expecting to have to learn php to modify a menu in a CMS system and this is the only thing I've come up with so far. Thanks for your help. Lloyd |
#4
|
|||
|
|||
OK, I don't understand what will be in link1.php, link2.php, link3.php - are those vb pages?
In any case, to show your sub menu only on your static page you could try this in your plugin code: Code:
if ($vbulletin->nodeid == 124) { // add sub menu } BTW, you are right about "static html" not being an html file. Its called that to distinguish from html that's put together "on the fly" by a php script when it runs. In the case of a static html page the content you enter never changes, it's just saved in the database and output as is. |
#5
|
|||
|
|||
Link1 will be descriptions of the software. Link2 will be a page with download links and installation instructions and Link3 will be the purchase links. All three pages will be static html pages.
When I add: if ($vbulletin->nodeid == 124) { sub-menu code } to my plugin, the Software Tab AND the Home tab is highlighted and the Home sub-menu is superimposed over the Software sub-menu. I'm getting closer, though. |
#6
|
|||
|
|||
Quote:
Code:
if (in_array($vbulletin->nodeid, array(124, 125, 126, 127))) or whatever the actual node ids turn out to be. Quote:
I guess that's some problem with the way you're adding your sub menu? To be honest I don't know how to do that offhand. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|