0

Is there any function like is_page(like in word press) in Drupal 6

so that I can hide primary navigation menu which is (printed using echo statement) in page.tpl.php.

My requirement is to hide navigation menu in certain pages (custom theme).

2 Answers 2

0

There is drupal_is_front_page

Check if the current page is the front page.

Return value

Boolean value: TRUE if the current page is the front page; FALSE if otherwise.

2
  • i am new to drupal can u please explain me what it does is_front_page Commented Jun 28, 2013 at 2:56
  • Check the manual, it explains all including the return value and what does it do etc.
    – niksmac
    Commented Jun 28, 2013 at 3:04
0

Since you want to decide to show or not to show your menu on a theme level you can use

  • $is_front in your page.tpl.php to decide whether it's your front page or not

    <?php if ($is_front && isset($primary_links)): ?>
      <?php print theme('links', $primary_links, array('class' =>'links', 'id' => 'navlist')) ?>
    <?php endif; ?>
    
  • $node if your page is build by rendering a node (Simple page for instance)

    <?php if (($node && !in_array($node->nid, array(1,2,3))) && isset($primary_links)): ?>
      <?php print theme('links', $primary_links, array('class' =>'links', 'id' => 'navlist')) ?>
    <?php endif; ?>
    

    In the above example the primary links are not rendered if you're viewing a node page where the node id is one of 1, 2 or 3. Comapare your path (node/2) or the path to edit the page/node if you are using the path module to get the id

  • If that didn't do the trick for you you should dig deeper into some preprocess possibilities using hook_preprocess but for that you need to provide further information.
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.