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
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

tom_o_t - November 10, 2009 - 23:07

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

tom_o_t - January 5, 2010 - 00:00
Component:Code» Documentation
Status:active» fixed

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

System Message - January 19, 2010 - 00:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.