4th May 2009
Today I had a task of displaying random node in a Views-generated sidebar block.
This is how to do that:
- edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
- in the Sort Criteria section, add the Random criteria.
It can’t be simpler than that.
This entry was posted on Monday, May 4th, 2009 at 13:19 and is filed under Drupal, Notepad, Software.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
February 20th, 2010 at 15:29
Wow, you have no idea how long i have been trying to work that out
February 20th, 2010 at 17:37
Chris, your Testimonials block is amazingly familiar
Other than that – nice site.
April 9th, 2010 at 19:45
The random sort is a great tip! I’ve got a site in dev and attempted to use the random block module but had numerous issues with it. This is much easier.
Do you know if there is an easy way to replace the block title with the title of the node from the view? I’m using random with the return limited to one node.
Jon
April 9th, 2010 at 22:22
You can use block template to override block’s title. Views UI provides nice and detailed list of template files to use for styling output – look for ‘Theming information’ or alike, your template filename might look like block-views–viewname.tpl.php
Theming with template files is relatively easy (and fast, and powerful), but may require a significant amount of time to get started. If you have a recent Drupal book with a chapter on theming – give it a try.
August 10th, 2010 at 5:13
thank you so much! such a simple solution but without your assistance, it was hidden and frustrating. thank you!