Skip to Content

apple no pic

For articles such as this one that have no accompanying image, we use coding within the theming layer of Views to add a default thumbnail image if the story appears on the frontpage. This relates to the tag that is attached to the story so for example in this case the apple tag is translated into the parent taxonomy of fruit.

Coding then checks the image directory for fruit.png and serves it up next to the relevant title.

The code looks something like this:

<?php

if($output==''){
$imagecache_image = theme('imagecache', 'imagecache-64thumb', '/files/default/fruit.jpg', $alt = '');
print '<img class="imagecache imagecache-imagecache-64thumb" title="fruits" alt="all fruit" src="files/default/fruit.jpg"/>';

}else{
print $output;
}

This is linked to via the theme information section in Views and can be adapted to suit a client's particular taxonomy system

Interesting idea - I shall

Interesting idea - I shall have to try it - thanks