Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By keneso on
Hi,
I am using this snip Stefan Lehmann gave me here to have a different image based on node, problem is it works fine with the id, but a couple of the nodes are views, and one is contact, how do I declare those?
<?php
$node = menu_get_object();
$menu_image = 'arrow_home.png';
if (!empty($node)) {
$images = array(2 => 'arrow_home.png', 3 => 'arrow_formazione.png', 4 => 'arrow_workshop.png', 5 => 'arrow_raccontabito.png');
$menu_image = isset($images[$node->nid]) ? $images[$node->nid] : $menu_image;
}
?>
<div class="fz-menu-bg">
<img src="/sites/all/themes/business/images/fz/<?php print $menu_image; ?>" />
</div>
Thank you
Comments
=-=
Questions regarding code are better served in the 'module development and code questions'. please edit the opening post and move it Thank you.
For others
For others looking for this kind of problem here is the solution.