How can I tell if node is being displayed as a block?
escoles - October 30, 2009 - 19:01
| Project: | Node Blocks |
| Version: | 6.x-1.2 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Is there a value I can test for to tell whether a nodeblock is being displayed as a node (either as a page, or as a teaser) or in a block?
Reason: I have a content type that I use to create nodeblocks, mostly so I can embed menus. (Can't use the same menu in two different regions, and Rep[lacement] Tags doesn't work with blocks.) I want to create a simplified template for this content type that lets people see the Title if it's displayed as a page, but hides it if it's displayed in a block. (Otherwise, I always have to hide the title using CSS -- and the title is still there cluttering up my HTML.)

#1
I don't know the answer to your question, but if all you need to do is display extra versions of a menu, I'd recommend http://drupal.org/project/menu_block - sounds like that might be a better way to get the result you're after.
#2
If a node is being displayed as a nodeblock, it will have that available in the $node object.
From nodeblock.module line 143:
<?php// Set a flag so that themes have more context.
$node->nodeblock = TRUE;
?>
#3
Automatically closed -- issue fixed for 2 weeks with no activity.