How to remove Extra <div> </div> In Drupal Views

mrroy69
mrroy69 used Ask the Experts™
on
Greetings  I've setup a view and tried to stripout most of the unwanted html from the default view template, so I created a template:
 views-view--xxx.tpl.php in in there all I have is the following

<?php print $header; ?>
<?php print $rows; ?>
<?php print $footer; ?>

Drupal still adds a wrapper_prefix (<div>) and wrapper_suffix (</div> to each row, even though I've unchecked every box that woould add a wrapper that results in:

<div>
mycode
</div>

<div>
my code
</div>

I've tried everything I know to get rid of those pesky <div></div> but no luck. Any help is appreciated. Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
I've figured this out...I can overide the views-view-unformatted.tpl.php by creating my own and putting it in my templates folder... SO I've created views-view-unformatted--xxx.tpl.php and just added the following to it, add that stripped those <div>'s

<?php if (!empty($title)): ?>

<h3><?php print $title; ?></h3>

<?php endif; ?>

<?php foreach ($rows as $id => $row): ?>


<?php print $row; ?>


<?php endforeach; ?>

Author

Commented:
:)
Aaron FeledyDrupal Developer and Consultant

Commented:
Views has tpls that are in use for rendering the view, each row, and each field. You can see which tpls are available for your view by viewing the "Theme: Information" on your view configuration page under the "advanced" section. Look in your Views module directory for a "theme" directory. This will contain all of the default tpl files. See descriptions of the files here. Which one you need to use will depend on which row style you are using in your view configuration. For example, ff you are displaying your rows as fields, you'll want to copy the views-view-fields.tpl.php file into your theme directory and rename it to views-view-fields--xxx.tpl.php replacing the xxx with the machine name of the view you wish to modify.

Be sure to flush your Drupal caches after adding or changing these files so that Drupal will apply them.
Aaron FeledyDrupal Developer and Consultant

Commented:
Oops... seems I was late to the party :)

Author

Commented:
Thanks yes. Once I added my new tpl I re-scanned the template files to make sure mine was being used for the output, and then flushed the caaches...Do you know of a similar way to do that with the panels output :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial