No announcement yet.

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

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

    $tabselected = '';
    $tablinks = '';
    if (THIS_SCRIPT == 'content.php?r=179-Recruitment')
        $tabselected = ' class="selected"';
    $template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?r=179-Recruitment">RECRUITMENT</a>'.$tablinks.'</li>' ;

  • #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.
    Michael Biddle - Follow me on Twitter!


    • #3
      You need to do two things:

      The condition in your PHP code needs to be
      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:
      <!-- Template vbcms_navbar_link-->
      <vb:if condition="$vboptions['selectednavtab'] == 'vbcms' AND !in_array($nodeid, array(1,2,3))">
      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.


      • #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.


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