PHP question ... how do I make this work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • theda
    Member
    • Sep 2006
    • 79
    • 4.0.x

    PHP question ... how do I make this work?

    How can i make this code work to select my recruitment tab when I am on the content.php page viewing specific article/section (r=179-Recruitment)? It seems to only work for the pages that are not articles. I can't find anything by googling on THIS_SCRIPT.

    Code:
    $tabselected = '';
    $tablinks = '';
    if (THIS_SCRIPT == 'content.php?r=179-Recruitment')
    {
        $vbulletin->options['selectednavtab']='Recruitment';
        $tabselected = ' class="selected"';
    } 
    $template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?r=179-Recruitment">RECRUITMENT</a>'.$tablinks.'</li>' ;
  • Michael Biddle
    Senior Member
    • May 2004
    • 503
    • 3.8.x

    #2
    Pretty positive THIS_SCRIPT does not work like that. Not tested, but something more along the lines of (Doubt this will work, but it's a push in the right direction.):

    PHP Code:
    if (THIS_SCRIPT == 'content' AND $_REQUEST["r"] == '179-Recruitment'
    Also, this would not get rid of the real content button being shown as highlighted.

    Comment

    • cellarius
      Senior Member
      • Aug 2005
      • 4586
      • 3.8.x

      #3
      You need to do two things:

      The condition in your PHP code needs to be
      Code:
      if (in_array($this->content->getNodeId(), array(1,2,3)))
      where 1,2,3 is a comma seperated list of nodes where you want your tab to be highlighted. The Node ID is the numer you see in your URL (in your case 179)

      Then do the following template edit:
      Code:
      <!-- Template vbcms_navbar_link-->
      <vb:if condition="$vboptions['selectednavtab'] == 'vbcms' [COLOR=Red]AND !in_array($nodeid, array(1,2,3))[/COLOR]">
      Add the part in red, and again 1,2,3 is a comma seperated list of node-ids you do not want the standard Home-Tab to be highlighted.

      Comment

      • theda
        Member
        • Sep 2006
        • 79
        • 4.0.x

        #4
        I will try this.. thanks Cellarius! I had worked it out with the r= and GET, but the home tab was still showing as ON.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...