Newsfeed component template > DIV not closed

GK User
Thu Aug 08, 2013 10:40 am
Hi,

I'm trying to use the "The world news II" template with mod_feed in Joomla 3. When I put the feed in the mainbody or elsewhere, the template breaks itself.

The reason seems to be the following:

Code: Select all
...<div class="box"><div><h3 class="header"><span id="module108">Lu sur le web</span></h3><div class="content">
         <div style="direction: ltr; text-align: left ! important"  class="feed">
      
   <ul class="newsfeed">
   <!-- Show items -->
      <ul>
                           <li>
                                 <h5 class="feed-link">
                  <a href="http://www.lemonde.fr/tiny/3458742/" target="_blank">
                  Présidentielle au Mali : la Cour constitutionnelle confirme la tenue d'un deuxième tour</a></h5>
               
                              </li>
                  </ul>
   </div></div></div><div class="box">...


As you can see, there is a missing closing div. Could you please tell me which file has to be touched? ;)

Thanks a lot
User avatar
Fresh Boarder

GK User
Thu Aug 08, 2013 2:58 pm
After a couple of hours dealing with World News II tpl and mod_feed, it appears that the problem comes from Joomla 3:

For mod_feed module,
Code: Select all
echo $module->content;


seems to return
Code: Select all
<div style="direction: ltr; text-align: left ! important"  class="feed small">
      
   <ul class="newsfeed small">
   <!-- Show items -->
      <ul>
                           <li>
                                 <h5 class="feed-link">
                  <a href="http://www.lemonde.fr/tiny/3458742/" target="_blank">
                  Présidentielle au Mali : la Cour constitutionnelle confirme la tenue d'un deuxième tour</a></h5>
               
                              </li>
                  </ul>


Does anybody could confirm this?
User avatar
Fresh Boarder

teitbite
Fri Aug 09, 2013 6:10 am
Hi

I'm looking at /modules/mod_feed/tmpl/default.php and this doesn't look to have a missing </div>. Please show me Your site.
User avatar
Moderator

GK User
Mon Aug 12, 2013 2:08 pm
My website is on an intranet... It will be impossible to give access to it.

After reviewing the mod_feed/tmpl/default.php file I persist in my way...

Here is the 3.1.5 file directly out of the boy:

Code: Select all
<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_feed
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
?>

<?php
if (!empty($feed) && is_string($feed))
{
      echo $feed;
}
else
{
   $lang = JFactory::getLanguage();
   $myrtl = $params->get('rssrtl');
   $direction = " ";
   if ($lang->isRTL() && $myrtl == 0)
   {
      $direction = " redirect-rtl";
   }

   // feed description
   elseif ($lang->isRTL() && $myrtl == 1)
   {
         $direction = " redirect-ltr";
   }

   elseif ($lang->isRTL() && $myrtl == 2)
   {
      $direction = " redirect-rtl";
   }

   elseif ($myrtl == 0)
   {
      $direction = " redirect-ltr";
   }
   elseif ($myrtl == 1)
   {
      $direction = " redirect-ltr";
   }
   elseif ($myrtl == 2)
   {
      $direction = " redirect-rtl";   }
   ?>
   <?php
   if ($feed != false)
   {
      //image handling
      $iUrl   = isset($feed->image)   ? $feed->image   : null;
      $iTitle = isset($feed->imagetitle) ? $feed->imagetitle : null;
      ?>
      <div style="direction: <?php echo $rssrtl ? 'rtl' :'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' :'left'; ?> ! important"  class="feed<?php echo $moduleclass_sfx; ?>">
      <?php
      // feed description
      if (!is_null($feed->title) && $params->get('rsstitle', 1))
      {
         ?>
               <h2 class="<?php echo $direction; ?>">
                  <a href="<?php echo str_replace('&', '&amp', $feed->link); ?>" target="_blank">
                  <?php echo $feed->title; ?></a>
               </h2>
         <?php
      }
      // feed description
      if ($params->get('rssdesc', 1))
      {
      ?>
         <?php echo $feed->description; ?>
         <?php
      }
      // feed image
      if ($params->get('rssimage', 1) && $iUrl) :
      ?>
         <img src="<?php echo $iUrl; ?>" alt="<?php echo @$iTitle; ?>"/>

      <?php endif; ?>

   <ul class="newsfeed<?php echo $params->get('moduleclass_sfx'); ?>">
   <!-- Show items -->
   <?php if (!empty($feed))
   { ?>
   <ul>
      <?php for  ($i = 0; $i < $params->get('rssitems', 5); $i++)
      {
         if( !$feed->offsetExists($i)) {
            break;
         }
         ?>
         <?php
            $uri = (!empty($feed[$i]->guid) || !is_null($feed[$i]->guid)) ? $feed[$i]->guid : $feed[$i]->uri;

            $uri = substr($uri, 0, 4) != 'http' ? $params->get('rsslink') : $uri;
            $text = !empty($feed[$i]->content) ||  !is_null($feed[$i]->content) ? $feed[$i]->content : $feed[$i]->description;

         ?>
            <li>
               <?php if (!empty($uri)) : ?>
                  <h5 class="feed-link">
                  <a href="<?php echo $uri; ?>" target="_blank">
                  <?php  echo $feed[$i]->title; ?></a></h5>
               <?php else : ?>
                  <h5 class="feed-link"><?php  echo $feed[$i]->title; ?></h5>
               <?php  endif; ?>

               <?php if ($params->get('rssitemdesc') && !empty($text)) : ?>
                  <div class="feed-item-description">
                  <?php
                     // Strip the images.
                     $text = JFilterOutput::stripImages($text);

                     $text = JHtml::_('string.truncate', $text, $params->get('word_count'));
                     echo str_replace('&apos;', "'", $text);
                  ?>

                  </div>
               <?php endif; ?>
               </li>
         <?php } ?>
         </ul>
   <?php }
   }
}


As we can see, there is two opening DIVs:
- the first at line 58 (the main content)
- the second at line 112 (the feed item description content)

The second one is closed at line 121. The first one is never closed.

The problem is the same with the two ul tags.
User avatar
Fresh Boarder

teitbite
Tue Aug 13, 2013 3:23 am
Hi

Yes I can see it as well :) I'll report this bug on joomla.org right now. Meanwhile add the closing </div> tag and copy this file to template's /html/mod_feed/default.php. This way You will keep the fix during joomla update in case they will not fix it soon.
User avatar
Moderator


cron