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