

It's been a few years I would say since some blogs implemented this random jumping functionality. It is not very useful, but it's fun and sometimes very handy when one is bored. Wikipedia has it, very popular blogs like Microsiervos have it... It is small, simple and fun.
Still I had never used it on my blogs. This morning, don't ask me why, I decided to implement it, which on Drupal becomes a very simple task. Let's see. In order to implement this functionality we need:
Both tasks are very easy in Drupal, if you are using Primary Links Menus and Page nodes. Now, let's see what the new page node has to do:
The two first tasks can be done on a single query using the MySql function Rand(). Also we can limit the query to return only one node. Next we redirect to the new done. Finally, we abort the execution of the page with an exit() call. This will indicate Drupal it doesn't need to keep generating and formatting the new random page, since the user will never see it actually. Here is the code:
Recent comments
2 years 4 days ago
2 years 1 week ago
2 years 1 week ago
2 years 2 weeks ago
2 years 5 weeks ago
2 years 8 weeks ago
2 years 9 weeks ago
2 years 10 weeks ago
2 years 11 weeks ago
2 years 11 weeks ago