Jump to content

Weekly rotating text


tretre34

Recommended Posts

I am looking for a solution to display text in a block of a Drupal website. The text needs to automatically change on a weekly basis. Any help on the code to use for this is much appreciated.

Link to comment
Share on other sites

I can think of many ways to do it, but they all require some form of storage, and Javascript can't store any information. You would need PHP or another server-side language. There is one way I could think of how to do it without some form of storage: Make an algorithm that returns a number based on the current week of the year. Since Javascript's Date() object doesn't return week numbers you will need to make a function to calculate that. Then you will need another function that selects a text based on that number. I think the modulo operator would work for that (%).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...