0 Пользователей и 1 Гость просматривают эту тему.
  • 2 Ответов
  • 2191 Просмотров
*

Armagedonec

  • Новичок
  • 2
  • 0 / 0
Помогите! :cry: Когда я создал ленту новостей в Joomla 3.3.3 с шаблоном Advocate то на моем сайте выдает вот такую ошибку "Warning: Invalid argument supplied for foreach() in Q:\home\localhost\wwwschool\templates\advocate\html\com_newsfeeds\newsfeed\default.php on line 58". Вот  код файла "default.php" ПОМОГИТЕ срочно нужно!

Код
<?php
/*
Advocate template for Joomla!
Commercial Software
Copyright 2014 joomlaxtc.com
All Rights Reserved
www.joomlaxtc.com
*/
defined('_JEXEC') or die;
?>
<?php

$lang = JFactory::getLanguage();
$myrtl = $this->newsfeed->rtl;
$direction = " ";

if ($lang->isRTL() && $myrtl == 0) {
   $direction = " redirect-rtl";
} 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";
               }
?>
<div class="newsfeed<?php echo $this->pageclass_sfx?><?php echo $direction; ?>">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<h1 class="pagetitle <?php echo $direction; ?>"><span>
   <?php echo $this->escape($this->params->get('page_heading')); ?></span>
</h1>
<?php endif; ?>
   <h2 class="<?php echo $direction; ?>">
      <a href="<?php echo $this->newsfeed->channel['link']; ?>" target="_blank">
         <?php echo str_replace('&apos;', "'", $this->newsfeed->channel['title']); ?></a>
   </h2>

<!— Show Description —>
<?php if ($this->params->get('show_feed_description')) : ?>
   <div class="feed-description" >
      <?php echo str_replace('&apos;', "'", $this->newsfeed->channel['description']); ?>
   </div>
<?php endif; ?>

<!— Show Image —>
<?php if (isset($this->newsfeed->image['url']) && isset($this->newsfeed->image['title']) && $this->params->get('show_feed_image')) : ?>
<div>
      <img src="<?php echo $this->newsfeed->image['url']; ?>" alt="<?php echo $this->newsfeed->image['title']; ?>" />
</div>
<?php endif; ?>

<!— Show items —>
<ol class="feedwrap">
   <?php foreach ($this->newsfeed->items as $item) :  ?>
      <li>
         <?php if (!is_null($item->get_link())) : ?>
             <h4 class="feedtitle" style='margin:0;padding:0;'><a href="<?php echo $item->get_link(); ?>" target="_blank">
               <?php echo $item->get_title(); ?></a></h4>
         <?php endif; ?>
         <?php if ($this->params->get('show_item_description') && $item->get_description()) : ?>
            <div class="feed-item-description">
            <?php $text = $item->get_description();
            if($this->params->get('show_feed_image', 0) == 0)
            {
               $text = JFilterOutput::stripImages($text);
            }
            $text = JHtml::_('string.truncate', $text, $this->params->get('feed_character_count'));
               echo str_replace('&apos;', "'", $text);
            ?>

            </div>
         <?php endif; ?>
         </li>
      <?php endforeach; ?>
      </ol>
</div>
*

motokraft

  • Завсегдатай
  • 1326
  • 72 / 13
Re: Лента новостей и шаблон Advocate
« Ответ #1 : 26.05.2015, 12:11:49 »
измени полностью 59 строку на это...
Код
 <?php print_r($this->newsfeed->items); // foreach ($this->newsfeed->items as $item) :  ?>

Что бы не было ошибку закоментируй endforeach; в 79 строке...

что выводиться на страницу...
...
*

Armagedonec

  • Новичок
  • 2
  • 0 / 0
Re: Лента новостей и шаблон Advocate
« Ответ #2 : 27.05.2015, 10:32:43 »
Цитировать
измени полностью 59 строку на это...
Код
 <?php print_r($this->newsfeed->items); // foreach ($this->newsfeed->items as $item) :  ?>

Что бы не было ошибку закоментируй endforeach; в 79 строке...
Сделал все как вы и сказали. Выдало новую ошибку "Fatal error: Call to a member function get_link() on a non-object in Q:\home\localhost\www\2school\templates\advocate\html\com_newsfeeds\newsfeed\default.php on line 60"

Вот код, может я неправильно что то сделал посмотрите

Код
<?php
/*
Advocate template for Joomla!
Commercial Software
Copyright 2014 joomlaxtc.com
All Rights Reserved
www.joomlaxtc.com
*/
defined('_JEXEC') or die;
?>
<?php

$lang = JFactory::getLanguage();
$myrtl = $this->newsfeed->rtl;
$direction = " ";

if ($lang->isRTL() && $myrtl == 0) {
$direction = " redirect-rtl";
} 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";
}
?>
<div class="newsfeed<?php echo $this->pageclass_sfx?><?php echo $direction; ?>">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<h1 class="pagetitle <?php echo $direction; ?>"><span>
<?php echo $this->escape($this->params->get('page_heading')); ?></span>
</h1>
<?php endif; ?>
<h2 class="<?php echo $direction; ?>">
<a href="<?php echo $this->newsfeed->channel['link']; ?>" target="_blank">
<?php echo str_replace('&apos;', "'", $this->newsfeed->channel['title']); ?></a>
</h2>

<!-- Show Description -->
<?php if ($this->params->get('show_feed_description')) : ?>
<div class="feed-description" >
<?php echo str_replace('&apos;', "'", $this->newsfeed->channel['description']); ?>
</div>
<?php endif; ?>

<!-- Show Image -->
<?php if (isset($this->newsfeed->image['url']) && isset($this->newsfeed->image['title']) && $this->params->get('show_feed_image')) : ?>
<div>
<img src="<?php echo $this->newsfeed->image['url']; ?>" alt="<?php echo $this->newsfeed->image['title']; ?>" />
</div>
<?php endif; ?>

<!-- Show items -->
<ol class="feedwrap">
<?php print_r($this->newsfeed->items); // foreach ($this->newsfeed->items as $item) :  ?>
<li>
<?php if (!is_null($item->get_link())) : ?>
       <h4 class="feedtitle" style='margin:0;padding:0;'><a href="<?php echo $item->get_link(); ?>" target="_blank">
<?php echo $item->get_title(); ?></a></h4>
<?php endif; ?>
<?php if ($this->params->get('show_item_description') && $item->get_description()) : ?>
<div class="feed-item-description">
<?php $text = $item->get_description();
if($this->params->get('show_feed_image', 0) == 0)
{
$text = JFilterOutput::stripImages($text);
}
$text = JHtml::_('string.truncate', $text, $this->params->get('feed_character_count'));
echo str_replace('&apos;', "'", $text);
?>

</div>
<?php endif; ?>
</li>
<?php /*endforeach;*/ ?>
</ol>
</div>
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Ошибка при входе в корзину шаблон jmart

Автор dimiur

Ответов: 5
Просмотров: 2687
Последний ответ 24.05.2023, 14:24:30
от Gleb72
Почему обновление шаблона ломает шаблон?

Автор gorbi_U

Ответов: 8
Просмотров: 1391
Последний ответ 03.05.2023, 22:54:19
от SmiP
Нужно ли переносить custom.css при переезде на новый шаблон?

Автор gorbi_U

Ответов: 3
Просмотров: 1053
Последний ответ 09.02.2023, 21:05:42
от marksetter
Где в Joomla 3.4.3 шаблон материала? Шаблон Yootheme Organic

Автор annushka

Ответов: 13
Просмотров: 4817
Последний ответ 13.09.2022, 11:14:56
от tuztref
Master3 – современный удобный гибкий шаблон для Joomla! 3 на фреймворке UIkit 3

Автор dron

Ответов: 81
Просмотров: 7627
Последний ответ 11.09.2021, 03:12:59
от vasileк