Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.