I've created a custom block for nodequeue using the views module. I would like to fetch a random node to display in this block. I've read the documentation in the nodequeue README.txt file that describes how to fetch a random node in a custom block. It is not clear to me how you would achieve this same effect using the views module. Is this something you can help with?

Comments

merlinofchaos’s picture

Status: Active » Fixed

All you need to do is apply the 'Sort: Random' sort, and set the nodes per page to 1. Be sure you have the proper filter for the nodequeue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

khazar’s picture

The View Module, at least 6.x-2.0-rc1, does not appear to offer a "Random" option in the Sort Criteria area. Just "asc" and "dsc". Is there something I'm missing?

blockedmind’s picture

yea, random is missing

ezra-g’s picture

Title: Fetch a Random Node using Views Block » Update Random Views Sort Order
Version: 5.x-1.2 » 7.x-2.x-dev
Category: support » task
Status: Closed (fixed) » Active

Thanks for pointing this out: The random sort order was not included in the update to Drupal 6. This is a valuable feature and should be included!

ezra-g’s picture

Component: Documentation » Code
merlinofchaos’s picture

Status: Active » Closed (fixed)

It's there.

ezra-g’s picture

It's in the "Global" group ;).

blockedmind’s picture

it does not select in random order. it helps displaying in random order only. that's not the same.

blockedmind’s picture

?

mgladding’s picture

Status: Closed (fixed) » Active

I too am a bit confused. I want to be able to randomly display a client quote in a block and I assumed this module would allow that. Many references to this node mention a "Sort:Random" option in Views.

What is the current standard for displaying random nodes via Nodequeue?

ezra-g’s picture

Status: Active » Closed (fixed)

The random sort order is part of the Views "Global" group and in my testing, with random as the only sort criteria, the nodes display in a random order upon refreshing. Only local images are allowed.

missiria’s picture

Thanks I need its too ;)

gmarcotte’s picture

global random does not work. adding this causes the filter node type to be ignored. on the preview I am getting nodes that are not the type I filtered for. the sql looks so I ave no idea how I could possible get this result.

some one above said something about nodequeue? this is drupal 6

SELECT node.nid AS nid,
node_data_field_rotateimage.field_rotateimage_fid AS node_data_field_rotateimage_field_rotateimage_fid,
node_data_field_rotateimage.field_rotateimage_list AS node_data_field_rotateimage_field_rotateimage_list,
node_data_field_rotateimage.field_rotateimage_data AS node_data_field_rotateimage_field_rotateimage_data,
node.type AS node_type,
node.vid AS node_vid,
node_revisions.teaser AS node_revisions_teaser,
node_revisions.format AS node_revisions_format,
RAND() AS _random
FROM node node
LEFT JOIN content_type_featurepage_rotate node_data_field_rotateimage ON node.vid = node_data_field_rotateimage.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.status = 1) AND (node.type in ('featurepage_rotate'))
ORDER BY _random ASC