views:

124

answers:

5

Hi,
I'm looking for terminology that describes this behavior:

The header of a web-page contains a different image every time you visit it.

Update: It is not an advertisement, but images related to the subject of the site.
E.g. An imaginary site for a bakery would show, next to the logo, randomly

  • a picture of the front of the shop
  • a macro shot of some patisserie
  • ...

More specifically: I'm building a Drupal site and was looking for a theme or module that could help me do that, but don't know the term to search for. 'Rotate', 'Image', 'Header' are rather ambiguous.

Related question: How to implement seasonal logos in Drupal?
But without the time constraints: I'm looking for 'just a random header for every visit'

Thanks!
Jan

+3  A: 

Given that this is usually an advert, it's usually called an AdRotator, like this one for ASP.NET.

Jon Skeet
A: 

I'm not aware of a module for this.

In case you need to do a custom implementation, be aware of caching problems - if you implement your rotation logic in the backend only, it will only work for non cached page views. If it needs to work for cached pages also, you'd need a javascript solution (either pulling the image separately, or, in case of a small set of images, setting different parts of a sprite).


Edit: Moved the following down, as the OP is not looking for ad-style solutions.

Some more terms from the realm of advertising:

  • 'superbanner' (or 'Super Banner') for the horizontal ads at the top
  • 'skyscraper' for the large vertical ads (usually on the right)
Henrik Opel
A: 

I wasn't looking for any ad-style solutions.

This site 'regularly' changes the picture at the top, and that doesn't annoy me.
I'm just assuming something along this solution for WordPress is used.

They use the term 'dynamic headers'.

And this was what I was looking for:

dh_get_random_media_item() - 
Will return the URL of a random media item contained in the Dynamic Headers media directory

Off to find something similar for Drupal.

jan
@jan: You should add clarifications by editing your question, as putting them in an answer will make them hard to find/easy to overlook for others. Good luck for the module hunting - in case you find something, it would be nice if you could post it here (in which case an answer would of course be the right way ;)
Henrik Opel
Will do!, and I'll update my answer when I find what I'm looking for. Thanks!
jan
+4  A: 

Also, you could just make a View that displays only nodes of a certain content types where you've stored your header images, then limit the number of nodes the view displays to one and under the sorting section add a random sort. That should bring up a new image on each page refresh.

By far the easiest solution.

EDIT: By the way, the Drupal equivalent of an "AdRotator" thing is a Rotor

theunraveler
+1 - Good catch, straight and simple
Henrik Opel
+1  A: 

This was a simple but effective solution, using cck and views:

Create a 'header pics' content type. Add fields for images, url, and 'show when' select list.

Images I used image upload with cropping module, constrained to 400px wide by 100px high to fit in header block.

'show when' select list I populated with summer, winter, fall, Halloween, Christmas, Veteran's Day, etc.

url is optional.

In view, filter by type = header_pic and show_when = whatever you want displayed now

Need the Customfield PHP module addon for views, and add:

<?php
$temp = node_load($data->nid);
if ($data->node_data_field_header_pic_url_field_header_pic_url_url) { 
    echo '<a href="' . $data->node_data_field_header_pic_url_field_header_pic_url_url 
. '" title="' . $data->node_data_field_header_pic_url_field_header_pic_url_title 
.'"><img src="/' . $temp->field_header_image[0]['filepath'] . '" /></a>';
} 
else { 
    echo '<img src="/' . $temp->field_header_image[0]['filepath'] . '" />';
}
?>

Where the fields I've noted correlate to your actual fields.

What this does is wrap the image with that url field only if the url field is populated.

Then set the view in a block display, and set that block in the header region. Depending on theme, you may need to hack the page.tpl.php a little to move that header block region into the real header area (but once you get in there it's easy to see what you need to do).

You can even make a page view of this same view to display all of your great header images at once on a page (/headerpics), with an edit link by each for easy manageability.

This will work if you just want seasonal images.

Kirk Hings