Part of my theme requires a special menu that was created outside of Drupal to disappear if an article is being viewed.

Is there a way to check to see if a page is being viewed in the node?

Comments

WorldFallz’s picture

Do you mean if a node is being displayed on a full page? If so, then yes, you can do <?php if ($page == 1): ?>

feeper’s picture

Thanks for the response WorldFallz.

Anything wrong with using <?php if (!$node->nid) { ?> <?php } ?>?

I just figured out that it would work, but if there are any draw backs to using that, let me know :)

michaelfavia’s picture

It depends on what template youre editing but if you need the $node->type you can use that too from the proper scope. The devel module might help you better understand what is possible. Or even better a debugger but that might be overkill for your theming tasks. If absolutely requires a node_load() will return a cached node object form node_load_multiple() and not require any database calls so you can get that info form any scope as well. -mf

feeper’s picture

Hey Michael,

Thanks for that!

It's a custom theme, so the $node->type is working just fine (so far!)