By sniegs on
So I would like to add icon next to the story titles.
Form example – NEW! for the first 2 days after it has been promoted to the front page, that ACTIVE for the time the story is relevant (with possibility to set the expiration date somewhere), the EXPIRING SOON! last 2 days before expiry, then GONE after that date passes, and optionally removed from the front page.
What would be the most natural, easy, "drupal" way to do this?
Comments
It depends on what you mean
It depends on what you mean by "expire", if you mean they become unpublished you could use the scheduler module for that part.
As for the icon part consider most themes place the node and it's content in a div and that div already has a id and a variety of classes. So you could add the following logic to the start of node.tpl.php (or node-story.tpl.php if it only applies to content of type story). Better yet would be to implement a preprocess function to set a variable for the class. Either way you would need code some like (this is a mix of PHP and psuedo code, it assumes it has $node available.
Then for example using the garland theme you would change this line in node.tpl.php (or node-page.tpl.php from
to
Then you can use css to add a non-repeating background image to the node based on the state class.
Thanks a lot, exactly what I
Thanks a lot, exactly what I was looking for!
Sorry for the time it took you, I would have hacked the code myself, the hard part was knowing in which places to plug it in drupal data model / file hierarchy.
Yes, by «expiring» I meant removing from the front page.
Icon?
Not a php programmer. Don't have a clue..
Anyway, is there any module i can use to have the icon "NEW" for new story as requested earlier? Need 1 >_<