tretre34 Posted April 16, 2012 Share Posted April 16, 2012 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 More sharing options...
Ingolme Posted April 16, 2012 Share Posted April 16, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.