I'm using the latest version for d6. I need to show 2 different nodes of a content type on the front page, with different formatting.

I created a different block for each of the two regions, and template file for the content type. The template file is being hit...contemplate tells me it's reading from it, and the two regions show output. The problem is that I cannot find a way to specify in the template which region the output is for. The two regions are $user1 and $user2, and if I put if($user2){ , for example, nothing inside is touched.

Comments

j. ayen green’s picture

I stumbled upon the answer. I'll document it here for anyone having the problem.

To access a region name, for example $user2, in the template, simply put
global $user2;

at the top of the template. Then, you'll be able to put if($user2){ } around the formatting you want to pass only to that region.

j. ayen green’s picture

I take it back...I thought the global was working, but when I cleared cache, I had no output for either region. So I'm back to asking...how do I check which region I'm creating content for while in the template?

nevets’s picture

You can use $block->region in block.tpl.php, for more block.tpl.php variables see http://api.drupal.org/api/file/modules/system/block.tpl.php/6

jrglasgow’s picture

Your template is processed in the nodeapi's 'alter' step. The information about what region the node will be placed in is not available to Content Templates.

I have 2 suggestions...

  1. Set up another node type.
  2. Use CSS to hide things in different regions, and change the formatting