[development] Drupal 7 Entities - view random node

Greenman greenman at the-organization.com
Mon Jan 24 10:56:37 UTC 2011

Hi Blaine

You should probably not be using the DB API to load the field value. Since
(in theory) we are able to have our actual field data stored in various
back-ends, you should only really load the data via node or entity loading

The node table itself is still reliably in Sql though, so you can select
which node to display via the DB API.


On 23 January 2011 19:33, Blaine Lang <Blaine.Lang at nextide.ca> wrote:

> I have a need for a block that will display a random quote. Node type =
> 'random_quote' and only 1 random record should be displayed
> In D7 the body contents are in field_data_body and I have it working
> using the DB API but it would probably be better using the
> entityController class methods like 'entity_load'
> I see that you can pass in conditions but is it possible to return a
> single random record?
> Does anyone with more experience with the new EntityController have any
> recommendations?
> Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110124/ce79b152/attachment.html 

More information about the development mailing list