By andrew_hoffi on
I'm trying to get a specific block to appear inside a node, I have the block appearing in all nodes from a view that I've created, however I now want to display a block only on a specific node. I've spotted some snippets that make use of arg(1) to get the node's ID. However this will not work for me as the URL references the view's path and not the individual node.
I ideally need to write the following PHP check in the "Show block on specific pages" field within the block configuration.
<?php
if ($node->nid = 67) {
return TRUE;
}
return FALSE;
?>
The only problem is the reference to $node->nid is not available, does anyone know of a work around for this?
Comments
How about $node =
How about
Note this only works when the node is display by it's self at node/{nid} where {nid} is a node id.
Unfortunately as you say it
Unfortunately as you say it will only work when a direct node is accessed, where as I'm displaying full nodes through the views module. Thanks for the suggestion though.
Thanks
Andrew
-------------------
www.hoffi.com
Just thought I should mention
Just thought I should mention that I've swapped the method to solve this problem. I'm now displaying a main page with blocks after the main body of content and any views required can now be placed in these blocks.
Thanks
Andrew
-------------------
www.hoffi.com