0

In D7 I have a search view but would like to change some layout of it.

My current HTML situation is:

<div id="block-block-12"  ..... </div>
<div id="block-block-13"  ..... </div>
<div id="block-block-14"  ..... </div>

In the current layout:

 --------------------------
|            |            |         
|     B12    |     B13    |  
|            |     B14    |         |
---------------------------

I would like to change this into

<div class ='xxtr'>
 <div id="block-block-12"  ..... </div>
 <div id="block-block-13"  ..... </div>
 <div id="block-block-14"  ..... </div>
</div>

The reason for this is that I would like to have a 100% background color styling with the help of class xxtr.

I set the width of all block at 33.3% but then the display is:

 ------------------------------------
|            |            |         |
|     B12    |     B13    |   B14   |
|            |            |         |
-------------------------------------

While the result should be with all the same background color:

 ------------------------------------
|            |            |         |
|     B12    |     B13    |   empty |
|            |     B14    |         |
-------------------------------------

I add a custom tpl for this query but do not understand how to get that extra div around these blocks.

The tpl file.

<?php

?>
<div class="<?php print $classes; ?> view--page">
    <div class="view-content-wrapper">

        <?php print render($title_prefix); ?>
        <?php if ($title): ?>
            <?php print $title; ?>
        <?php endif; ?>
        <?php print render($title_suffix); ?>
        <?php if ($header): ?>
            <div class="view-header">
                <?php print $header; ?>
            </div>
        <?php endif; ?>


        <?php if ($exposed): ?>
            <div class="view-filters">
                <?php print $exposed; ?>
            </div>
        <?php endif; ?>

        <?php if ($attachment_before): ?>
            <div class="attachment attachment-before">
                <?php print $attachment_before; ?>
            </div>
        <?php endif; ?>

        <?php if ($pager): ?>
            <?php print $pager; ?>
        <?php endif; ?>

        <?php if ($rows): ?>
            <div class="view-content">
                <?php print $rows; ?>
            </div>
        <?php elseif ($empty): ?>
            <div class="view-empty">
                <?php print $empty; ?>
            </div>
        <?php endif; ?>

        <?php if ($pager): ?>
            <?php print $pager; ?>
        <?php endif; ?>


        <?php if ($attachment_after): ?>
            <div class="attachment attachment-after">
                <?php print $attachment_after; ?>
            </div>
        <?php endif; ?>

        <?php if ($more): ?>
            <?php print $more; ?>
        <?php endif; ?>


        <?php if ($footer): ?>
            <div class="view-footer">
                <?php print $footer; ?>
            </div>
        <?php endif; ?>

        <?php if ($feed_icon): ?>
            <div class="feed-icon">
                <?php print $feed_icon; ?>
            </div>
        <?php endif; ?>
    </div>

</div><?php /* class view */ ?>

Any suggestion ?

  • The html output you describe come from the whole result of the view or this is result for one row ? – Ziftman Jun 26 '17 at 13:56
  • neither one of them. 2 blocks are facets and 1 block is the search box of the view itself – Justme Jun 26 '17 at 13:57
  • depends on your template and how you structure the page, are you Dropping this 2 blocks in one region? if yes and the region would hold only this 2 blocks, you can add the wrapper dev in the region template see Region template another solution which could be a bit complicated is to create template file or function using hook_theme and then you create custom block and assign the output of the template to the block content, so you would have 1 block contain the 2 piece, see views_embed_view function for that. – Ziftman Jun 26 '17 at 14:03
0

I solved this by adding the view of the second box in the footer of the first box and add the php code of the third box in the footer of the second view. This way only one box is shown and with the help of the blok_wrapper css can be used to layout this template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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