Hi, I need to insert something in the header on nodes (content pages) but when I checkout node.tpl.php there's no header (although there is on on page.tpl.php.

How do I go about this?

Thanks in advance

Comments

nevets’s picture

The header is always part of page.tpl.php, node.tpl.php is just responsible for formatting a node. In page.tpl.php, for pages that are a single node (ie unaliased path of form node/{nid}), $node is available.

mfizzel’s picture

Thanks, I'm not sure I fully understand though.

I need to place code in the header for content pages but I don't want it to appear on the index or anywhere else, how do I go about that?

Thanks

nevets’s picture

Something like this (it goes in page.tpl.php in the header section)

<?php if (  !empty($node) ) : ?>
... add to header here
<?php endif; ?>

Note there are modules to add to the header for content. Depending on what you want to add there maybe a module for it.