Jump to content

Issue with Drupal (Block variables)


sijumonap

Recommended Posts

I will explain the doubt with my block.tpl.php.

 

<?php
<div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
    <h2 class="title"><?php print $block->subject; ?></h2>
    <div class="content"><?php print $block->content; ?></div>

//the following area I have used with reference of the Drupal manual
$module = 'some_module'; //how can we assign a constant value for this when there are five or six blocks/regions in the page
$delta = 0; //how can we assign a constant value for this when there are five or six blocks/regions in the page
if ( $block->module == $module && $block->delta == $delta ) {
print l('(edit this block)', "/admin/build/block/configure/$block->module/$block->delta");
}
?>

 

Note: I have commented my doubts with two lines of the above code.

 

In my case, there are five blocks in the page and I want to insert the "Edit this Block" link only for a block. When I tried to use the code without an IF condition, it comes for all blocks. So, I have inserted that part of your code in it. For that, I want to check with the variable '$block->delta' like this:

if ($block->delta == '----something----' )

But, I don't know it's value. So, please give me the guidelines to get the variable.

Link to comment
https://forums.phpfreaks.com/topic/91292-issue-with-drupal-block-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.