0

I am new to panels, using panels module to set the page that contains 3 views on it (nothing wrong with these views), when I add the content, the output displays weird tags those are wrapping the content there fore the layout on the front end gets disturbed.

Here is the link to my website page : http://lookwhatwemadeyou.com/trillist/news-press , find "Recent from the Blog" Section.

Q: How to remove these extra tags? where these tags are coming from as I didn't create any custom layout. Is there any way to control the layout other then overriding the panel layouts templates?

<div class="info-node panel-main">
  <div class="panel-flexible panels-flexible-4 clearfix">
      <div class="panel-flexible-inside panels-flexible-4-inside">
      <div class="panels-flexible-region panels-flexible-region-4-center panels-flexible-region-first panels-flexible-region-last ">
          <div class="inside panels-flexible-region-inside panels-flexible-region-4-center-inside panels-flexible-region-inside-first panels-flexible-region-inside-last">
          <div class="">
              <div class="panel-pane pane-custom pane-1">
              <h2 class="pane-title"> Latest News </h2>
              <div class="pane-content">
                  <p><strong>Lorem ipsum is a dummy text.Lorep ipsum is a dummy text. Lorem ipsum is a dummy text.Lorep ipsum is a dummy text.</strong></p>
                </div>
            </div>
              <div class="view view-news-press view-id-news_press view-display-id-block view-dom-id-3f0fd15282c7a83bbd1836b458a38681">
              <div class="view-content">
                  <div class="views-row views-row-1 views-row-odd views-row-first">
                  <div class="col-sm-12 border_post">
                      <div class="col-sm-5">
                      <div class="post_img"><img width="425" height="300" src="sites/default/files/styles/list_style_425x300/public/post_2.png?itok=iDl8-7nV" typeof="foaf:Image"> </div>
                    </div>
                      <div class="col-sm-6">
                      <div class="post_text">
                          <h3> <a href="/trillist/news-6">News 6</a> </h3>
                          <h5> By:<span datatype="" property="foaf:name" typeof="sioc:UserAccount" about="/trillist/users/admin" xml:lang="" class="username">admin</span> | <span content="2016-04-19T15:45:00+05:00" datatype="xsd:dateTime" property="dc:date" class="date-display-single">Tuesday, April 19, 2016 - 15:45</span> </h5>
                          <div class="post_desc">
                          <p>Lorem ipsum is a dummy text.Lorep ipsum is a dummy text. Lorem ipsum is a dummy text.Lorep ipsum is a dummy text. Lorem ipsum is a dummy text.Lorep ipsum is a dummy text.</p>
                        </div>
                          <div class="post_btn"><a class="btn-dark" href="/trillist/news-6">Learn More<i class="fa fa-angle-right"></i></a></div>
                        </div>
                    </div>
                    </div>
                </div>
                </div>
            </div>
              **</strong></strong></div>
          <strong><strong> </strong></strong> </div>**
        </div>
    </div>
    </div>
</div>

the view's template.tpl.php file is

<div class="col-sm-12 border_post"> 
  <div class="col-sm-5">
    <div class="post_img">
      <?php print $fields['field_image']->content; ?>
    </div>
  </div>
<div class="col-sm-6">
  <div class="post_text">
    <h3> <?php print $fields['title']->content;  ?>  </h3>
    <h5> By:<?php print $fields['name']->content; ?> | <?php print $fields['field_date']->content; ?> </h5>
    <?php $body =$fields['body']->content;
      $bodycontent =  strlen( $body ) > 230  ? substr( $body, 0, 227 ) .'...' : $body;   ?>
      <div class="post_desc"><?php print $bodycontent ;   ?></div >
    <?php if(!empty($fields['field_link']->content)) {
      $link=$fields['field_link']->content;
    }
    else {
      $link=$fields['path']->content;
    }?>
    <div class="post_btn">
      <a href="<?php echo $link; ?>" class="btn-dark">Learn More
        <i class="fa fa-angle-right"></i>
      </a>
    </div>
  </div>
</div>
  • Will it be possible for you to give me the export of the panels and the views that you are rendering on the page? Share the link of the gist on this if you are comfortable. – Nitesh Sethia Apr 21 '16 at 6:25
  • @NiteshSethia Can you plz guide me how to export ? – Esar-ul-haq Qasmi Apr 21 '16 at 6:28
3

There was some issue in the template file.

You have used

$bodycontent =  strlen( $body ) > 230  ? substr( $body, 0, 227 ) .'...' : $body;   ?>
<div class="post_desc"><?php print $bodycontent ;   ?></div>

Instead of using that, we should use the Rewrite result of the body and add the trim length. Along with that we should do STRIP HTML TAGS to strip off all the tags thats there in the body when showing a listing page.

  • Thanks alot @Nitesh Sethia ...it worked ... feeling very glad ... – Esar-ul-haq Qasmi Apr 21 '16 at 7:47
0

When you look at the source you will notice that most of the strong tags only open and never close. That means the browser is compensating and closing it for you on a best guess scenario. In my experience these type of errors are usually the result of outputting partial html formatted strings in Views. As only the first part of the string is printed the closing tag never makes it into the output.

Go through your Views and make sure that you STRIP HTML TAGS from the strings that are printed partially. These will normally be the body fields.

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.