im running drupal 6
learning to make a theme and i got this code but i dont understand the code here

<?php
// $Id: block.tpl.php,v 1.3 2007/08/07 08:39:36 goba Exp $
?>
<div id="block-<?php print $block->module .'-'. $block->delta; ?>"
class="clear-block block block-<?php print $block->module ?>">
<?php if (!empty($block->subject)): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>
<div class="content"><?php print $block->content ?></div>
</div>

what does minus sign mean after block "block-< and $block-module on line 4 and even .'-'.

please help

Comments

nevets’s picture

For something like $block->module the -> tells the variable $block is a module and the code is accessing the module field/element of the object.

The other minus signs are part of strings so in the case of the id if $block->module was 'user' and $block->delta was 1 you would have a div with the id 'block-user-1'.

decibel.places’s picture

<div id="block-<?php print $block->module .'-'. $block->delta; ?>"

means the block id is "block-[plus output of following php code]"

 .'-'. 

uses the php concatenate character "." (period) which joins two strings of text
So the text before the hyphen is joined to the hyphen and the text after the hyphen is added on too after the hyphen

~are you netsperienced? http://netsperience.org

ktleow’s picture

For details and explanation on these terms, kindly refer to the core block.tpl.php file located in (root>modules>system>block.tpl.php)

That template file should help you.