[support] Need Help with A Block Knowing Info About First Node in a View

Shai Gluskin shai at content2zero.com
Fri Apr 15 04:56:14 UTC 2011


I've got a situation where I need a block to know about the contents of the
node being displayed.

I've got a block with custom code which starts,

if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
    $node = node_load(arg(1));

That works for when the node is displaying on its own page.

But my problem is that I am displaying the node using Views and not on its
own page. The reason I am doing this is that that the one node that displays
in the view dynamically changes depending on the $node->created time. The
view works perfect for this; one URL, dynamic content.

But I need the block to have access to the node object of the one node
currently displaying in the View.

What is coming to mind is to run the same query in the block that the view
is running to get the $nid and do the node_load off of that. But I thought
there was an easier way. Or do I have access to the View object?

Thanks for your suggestions,

Shai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110415/ef49ebf2/attachment.html 


More information about the support mailing list