By internets on
Hello,
I've been looking at examples of using node_load() and most examples in the API show loading a specific node by nid. http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...
How would I go about loading the latest published node of a certain type?
I'm just trying to figure out the 'conditions' format to say.
$my_node = $node_load(array('type' => $node->type, 'date' => ??? latest / newest post ???));
Any direction / suggestions or examples appreciated.
Thank you
Comments
hi,I have just cracked the
hi,
I have just cracked the "admin/content" callback and found the solution...
good luck...,
Thanks for the suggestion.
Thanks for the suggestion. That code appears to be for Drupal 7.
For Drupal 6 I found a way to get the info I wanted using db_query... There could be a better way but this works for me.
My goal is just to check if the current node is the most recent from node-type.tpl.php, if it is, then do something special. So I'll see if the loaded $nid->nid is the same as $node->nid and if so, show a special 'new' notice' otherwise show as a normal node.
So here is what I'm using to get the newest node for now.