Variables not available in block override?

facelikebambi - May 5, 2008 - 11:02

Hi

I'm learning Drupal and have got stuck on this one...

Trying to customise the display of a block (in this case, Simplenews block). The documentation says the variable $block['subscribed'] will be TRUE or FALSE depending on user status.

To test this, I created block-simplenews.tpl.php to override the block - no problem there.

Then I add this line to test the variable:

<?php print $block->subscribed; ?>

But it displays nothing, suggesting that the variable is not set/available here?

Do I need to add something to template.php to make the block variables available? I didn't think this was necessary for block, box, node, page etc in 5.x?

Hope this makes sense! Thanks

To see what variables are

casey - May 5, 2008 - 12:36

To see what variables are available, put the following code in your tpl.php

<?php print var_export($variables, TRUE); ?>

$variables['block'] has same value as $block in .tpl.php files.

 
 

Drupal is a registered trademark of Dries Buytaert.