Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 05-14-2012, 07:20 PM
Lloyd32552 Lloyd32552 is offline
 
Join Date: Feb 2009
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 05-14-2012, 07:33 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 05-14-2012, 08:09 PM
Lloyd32552 Lloyd32552 is offline
 
Join Date: Feb 2009
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 05-14-2012, 08:25 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 05-14-2012, 08:43 PM
Lloyd32552 Lloyd32552 is offline
 
Join Date: Feb 2009
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 05-14-2012, 08:53 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lloyd32552 View Post
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.
So you're going to create those as CMS static pages and you want the menu to appear on those as well? Then I guess you're going to want to do something like:

Code:
if (in_array($vbulletin->nodeid, array(124, 125, 126, 127)))

or whatever the actual node ids turn out to be.


Quote:
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.

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.
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 05:17 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.06970 seconds
  • Memory Usage 2,206KB
  • 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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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