I know this can probably be done with CCK and a view, and maybe a logo content type. But I was wondering if anybody knows of the BEST way to do the following (perhaps there is a module that does this already):
I want SEASONAL displays of my logo. I.e. If I create a CHRISTMAS version of my logo, with for example a a christmas hat in the logo, this must be shown on Christmas, or 7 days before christmas. This 7 days must be changeable on a PER LOGO basis. I.e. I might want to show christmas logo for the whole of december, but the holloween one only for one day.
It must automatically choose between the various logos and ALSO, cater for LANGUAGES. I have three languages and therefore three different logos on my site.
If it was a set of very simple rules, I'd just do that from the template page (if it is december, include this logo, if not include this other logo, etc...).
If you want this to be fully customizable, then I'd make a small module, and perhaps a logo CCK translatable content type, with an image and date ranges, so it would select the images appropriately according to your rules. Then the module would export a block to be put in one of the regions, say the header. This would also be language-aware.
I think that a view may be not sufficient to do the complete thing, it needs to be a bit complicated...
Just use a bit of raw php...
If your site uses normal url structure for languages you do something like this:
Then some regular date() stuff you could do something like this:
Then use those two variables to build a css class for you logo like this:
Which when rendered will produce something like this:
There is a drawback to having a content type for logos, in that you will need to do two node loads for every page.
An alternative solution would be to implement a module which created a logo block. You could then tweak your theme to have a region where the logo is and put this block into the region. You could have whatever logic you want in the block. Including an admin interface if you so wish. This could be cached per user (and cleared once a day) so the overhead would just be a load of a block from cache rather than a node load. This also keeps presentation and logic separate, and I could imagine that a seasonal image module would be quite popular.
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, limit = 1.
Need the Customfield PHP module addon for views, and add:
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. It's a simple form for non-technical users to upload and crop images. The only admin need is the occasional season (show when) changes in view filter.