I wonder does anyone know a way of getting the last nid.
Basically what I'm after is some way in a block visibility snippet of being able to say what was the node id of the previous node.
Or even a way of storing the nid as a variable which will be available on the next page.
Hope that makes some sense.

Comments

slicedsoup’s picture

With taxonomy if you have two routes to the same node
such as:
Animal ->Wild -> Elephant
&
Colour ->Grey -> Elephant

And if you navigate to the node 'elephant' how do you find out which of the two paths you took?
It seems like it should be an easy thing but maybe I'm missing something.

For my purposes I want to be able to show specific blocks depending on what path was taken.

loloyd’s picture

I got this information from the page http://drupal.org/node/292868.

I have also been looking for a way to always display the latest and greatest node ID in an admin's block as I am the only one maintaining my website. So this purpose will be useful only for single authorship sites, or maybe applicable also to multi-author sites with a tightly controlled node content posting policy.

These PHP lines can help you get the summary statistics you may need. I am not sure if this is still applicable to D5 but I have tested this in D6. I have no idea if it will work in D7.

$node_count = db_result(db_query("SELECT COUNT(*) FROM {node}"));
$topics_count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = 'forum'"));
$users_count = db_result(db_query("SELECT COUNT(*) FROM {users}"));

echo "Node count = $node_count<br />\nTopics count = $topics_count<br />\nUsers count = $users_count<br />\n";

I think from this snippet, you can get the general idea.

mgifford’s picture

If you delete a single node it will be off. This is a better approach:
http://drupal.org/node/947368#comment-3607060