0

Here, i struggling to remove inner div from create block in drupal 7.Here my working code with wrong result:

 <div class="ft_bottom">
<div class="container">
<div class="col-md-7">
<?php  if($page['footer_bottom_left']){ print render($page['footer_bottom_left']);} ?>
</div>
<div class="col-md-5">
  <?php  if($page['footer_bottom_left']){ print render($page['footer_bottom_right']);} ?>
</div>
</div>
</div>

I used string_tags before render it remove entire html tags. But i need to remove only block div and content div.Here my wrong result:

<div class="col-md-5">
  <div class="region region-footer-bottom-right">
    <div class="block block-block" id="block-block-5">
      <div class="content">
    <ul>
    <li><a href="#">Plan du site</a></li>
    <li><a href="#">Acessibilite</a></li>
    <li><a href="#">Credits</a></li>
    <li><a href="#">Mentions legales</a></li>
</ul>  </div>
</div>
  </div>
</div>

Correct format:

<div class="col-md-5">

        <ul>
        <li><a href="#">Plan du site</a></li>
        <li><a href="#">Acessibilite</a></li>
        <li><a href="#">Credits</a></li>
        <li><a href="#">Mentions legales</a></li>
    </ul> 
    </div>

How to remove inner div from custom block in drupal 7.Kindly guide me..?

2
  • I feel like we need more information. Are you using a custom template file? A preprocess hook and adjustment for this specific block? Commented Jun 10, 2015 at 15:45
  • Yes i used custom template ! @AlexLaughnan and how to create custom function for changing block in template.php file?
    – VIVEK-MDU
    Commented Jun 10, 2015 at 15:54

1 Answer 1

1

The markup you require removing comes from one or more template files. While i have no idea what theme you are using, ill assume its one that hasn't overidden the default template files..

If you go and get the file modules/system/region.tpl.php and copy it to your theme folder you can remove the markup you do not require. e.g. delete <div class="region region-footer-bottom-right">

To get rid of the rest of the markup you will have to override the block template in the same fashion, to only remove the markup from 1 specific block you can use naming suggestions here https://www.drupal.org/node/1089656

note: Flush the caches for the theme to pick up the presence of any new template files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.