By enochRoot on
Hi,
I'm trying to display breadcrumbs only on pages with a certain content-type.
This is the code in question:
<?php if($node->type == 'type1' || $node->type == 'type2'): ?>
<div>
<?php print $breadcrumb; ?>
</div>
<?php endif; ?>
which for type2 outputs the breadcrumbs as intended, but for type1 results in a notice stating 'node' is undefined and the output of just the 'Home' - link.
I've read this:
$node: The node object, if there is an automatically-loaded node associated with the page, and the node ID is the second argument in the page's path (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).
(http://api.drupal.org/api/drupal/modules%21system%21page.tpl.php/7)
but I don't see in what way the two content types differ...
Thanks for any suggestions,
eR
Comments
Do you know how to create a
Do you know how to create a module? If so, I personally would do something like:
if not, you can do it in your themes template.php file via hook_preprocess_page():
thanks
thank you for the suggestions, I will probably try both in different contexts...
right now I'm still hoping for a social hacking solution (i.e. convince someone that it's a stupid idea to have breadcrumbs only on specific pages)
;)
eR
I agree, consistency will
I agree, consistency will always make it easier for any site user, so if they are expecting a breadcrumb but not seeing it, their heads might explode.