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

jeka.l

  • Новичок
  • 2
  • 0 / 0
Ок. понял. Спасибо!
*

Krohalong

  • Новичок
  • 1
  • 0 / 0
Помогите пожалуйста, у меня следующая проблема-в Guestbook (когда пишешь комментарий) не работает кириллица, вместо букв вопросительные знаки.Решил переустановить модуль. после этого выдает ошибку Warning: Invalid argument supplied for foreach() in Z:\home\lalalaflowers.com\www\templates\tz_nicanian2\html\com_tz_guestbook\guestbook\default_item.php on line 3
Код
 foreach($this->hienthi as $rr){

        ?>

        <div class="warp-comment" data-order="<?php echo $rr->cid; ?>">

            <div  class="nnt-warp-comment-class">

                <ul>

                    <?php

                    if(isset($this->tit) && $this->tit == 1){

                        ?>

                        <li class="nnt-warl-comment-li-title">

               
*

mj23

  • Осваиваюсь на форуме
  • 28
  • 2 / 0
Помогите убрать ошибку.
Приходит в письме заказа
Warning: Invalid argument supplied for foreach() in /components/com_jshopping/templates/default/checkout/orderemail.php on line 420

Код
<?php foreach($files as $file){?>
                <div><?php print $file->file_descr?> <a href="<?php print JURI::root()?>index.php?option=com_jshopping&controller=product&task=getfile&oid=<?php print $this->order->order_id?>&id=<?php print $file->id?>&hash=<?php print $this->order->file_hash?>&rl=1"><?php print _JSHOP_DOWNLOAD?></a></div>
            <?php }?>
 
*

Санечек

  • Осваиваюсь на форуме
  • 13
  • 0 / 0
В моем случае глючил плагин комента от JC удалил плагин все работает, смотрите в пути, тчто прописано возможно отключив тот или иной плагин можно победить с наименьшими потерями, имею введу отключения функций Joomla...
*

eurostyle

  • Новичок
  • 1
  • 0 / 0
Warning: Invalid argument supplied for foreach() in  public_html/components/com_jshopping/tables/config.php on line 97      выскакивает при оформлении заказа в джумшопинге
*

svkarma

  • Новичок
  • 2
  • 0 / 0
Дважды здесь спрашивали про одинаковую ошибку Warning: Invalid argument supplied for foreach() in /home/svetartb/public_html/libraries/joomla/database/database/mysql.php on line 383. Но почему-то на другие отвечают, а про эту ошибку ни слова. Кто в курсе? Что это из-за чего? Вчера была одна строчка, а сегодня уже 2 одинаковых? Вот кусок кода, в котором какая-то ошибка. Может кто-нибудь подскажет решение
Код: php
else
{
foreach ($fields as $field)
{
$result[$field->Field] = $field;
}
}

return $result;
}
*

passer

  • Завсегдатай
  • 1013
  • 75 / 3
Не нужно лазить в код ядра. Скорей всего какой-то компонент некорректно вызывает или таблица пустая. Забей. На хостинге warning не будет.
*

Luk

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
Warning: Invalid argument supplied for foreach() in  public_html/components/com_jshopping/tables/config.php on line 97      выскакивает при оформлении заказа в джумшопинге
такая же история, помогите )

   function getEnableDeliveryFiledRegistration($type='address'){
        $tmp_fields = $this->getListFieldsRegister();
        $config_fields = $tmp_fields[$type];
        $count = 0;
        foreach($config_fields as $k=>$v){
            if (substr($k, 0, 2)=="d_" && $v['display']==1) $count++;
        }
    return ($count>0);
    }
*

Fedor Vlasenko

  • Живу я здесь
  • 3845
  • 733 / 7
  • https://fedor-vlasenko.web.app
Код: php-brief
function getEnableDeliveryFiledRegistration($type='address'){
        $tmp_fields = $this->getListFieldsRegister();
        $config_fields = $tmp_fields[$type];
        $count = 0;
if(!count($config_fields)) return false;
        foreach($config_fields as $k=>$v){
            if (substr($k, 0, 2)=="d_" && $v['display']==1) $count++;
        }
    return ($count>0);
    }
*

MoonFox

  • Осваиваюсь на форуме
  • 15
  • 0 / 0
Добрый день!

У меня в карточке товара пишет следующую ошибку : Warning: Invalid argument supplied for foreach() in /var/www/u8009739/data/www/majesticwood.ru/templates/theme474/html/com_virtuemart/productdetails/default_addtocart2.php on line 44

Вот код default_addtocart2.php
Код
defined('_JEXEC') or die('Restricted access');
if (isset($this->product->step_order_level))
$step=$this->product->step_order_level;
else
$step=1;
if($step==0)
$step=1;
$alert=JText::sprintf ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED', $step);

if ((!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) && !$this->product->images[0]->file_is_downloadable) { ?>
<div class="addtocart-area">

<form method="post" class="product js-recalculate" action="index.php" >
                <input name="quantity" type="hidden" value="<?php echo $step ?>" />
<div class="price">
                                                    <?php
                                                        // Product Price
                                                        if ($this->show_prices and (empty($this->product->images[0]) or $this->product->images[0]->file_is_downloadable == 0)) {
                                                            echo $this->loadTemplate('showprices');
                                                        }
                                                    ?>
                           
                                                </div>
<?php
foreach ($this->product->customfieldsCart as $field) {
if ($field->custom_value=='stockable'){
$stockvariant = '1';

}else {$stockvariant = '0';}

}
//print_r($stockvariant);
// Product custom_fields
if (!empty($this->product->customfieldsCart)) { ?>
    <div class="product-fields">
<?php foreach ($this->product->customfieldsCart as $field) { ?>
    <div class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->custom_title)?></b></span>
<?php if ($field->custom_tip)
    echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png'); ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
    </div>
    <?php
}
?>
    </div>
<?php } ?>

<?php
/* Product custom Childs
* to display a simple link use $field->virtuemart_product_id as link to child product_id
* custom_value is relation value to child
*/

if (!empty($this->product->customsChilds)) {
    ?>
    <div class="product-fields">
    <?php foreach ($this->product->customsChilds as $field) { ?>
    <div class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title)?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value)?></span>
<span class="product-field-display"><?php echo $field->display ?></span>

    </div>
<?php } ?>
    </div>
<?php } ?>



<div class="addtocart-bar2">
                <?php // Display the quantity box
if ($stockvariant=='1') { ?>
<div class="wrapper">
                                            <div class="controls">
                                                <span class="quantity-box">
                                               <input type="text" class="quantity-input js-recalculate" name="quantity[]" onblur="check(this);" value="<?php if (isset($this->product->step_order_level) && (int)$this->product->step_order_level > 0) {
echo $this->product->step_order_level;
} else if(!empty($this->product->min_order_level)){
echo $this->product->min_order_level;
}else {
echo '1';
} ?>"/>
                                                </span>
                                                <span class="quantity-controls js-recalculate">
                                                <input type="button" class="quantity-controls quantity-plus" />
                                                <input type="button" class="quantity-controls quantity-minus" />
                                                </span>
                                                <?php // Display the quantity box END ?>
                                                </div>
                                               
                                        </div>
                                        <div class="wrapper">
                                                <div class="fright">
                                                       
                                                        <?php
                                                        // Ask a question about this product
                                                            if (VmConfig::get('ask_question', 1) == '1') { ?>
                                                               <div class="ask-a-question">
                                                                    <a class="ask-a-question" href="<?php echo $url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL')?></a>
                                                                    <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 800, y: 750}}" href="<?php echo $url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL')?></a>-->
                                                                    </div>
                                                            <?php } ?>
                                                            <?php
                                                        // Manufacturer of the Product
                                                        if (!empty($this->product->virtuemart_manufacturer_id)) {
                                                          echo  $this->loadTemplate('manufacturer');
                                                        }
                                                        ?>
                                                        </div>
                                                <span class="addtocart-button">
                                                <input type="submit" name="addtocart"  class="addtocart-button cart-click2" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO')?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO')?>" />
                                                </span>
                                            </div>
<?php } else { ?>
<?php // Display the quantity box

    $stockhandle = VmConfig::get('stockhandle', 'none');
    if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {

?>
<div class="wrapper">
                                                <span class="addtocart-button">
                                                    <a class="addtocart-button" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id='.$this->product->virtuemart_product_id); ?>"><?php echo JText::_('COM_VIRTUEMART_CART_NOTIFY')?></a>
                                                </span>
                                                <div class="fright">
                                                           
                                                            <?php
                                                            // Ask a question about this product
                                                                if (VmConfig::get('ask_question', 1) == '1') { ?>
                                                                   <div class="ask-a-question">
                                                                        <a class="ask-a-question" href="<?php echo $url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL')?></a>
                                                                        <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 800, y: 750}}" href="<?php echo $url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL')?></a>-->
                                                                        </div>
                                                                <?php } ?>
                                                                <?php
                                                            // Manufacturer of the Product
                                                            if (!empty($this->product->virtuemart_manufacturer_id)) {
                                                              echo  $this->loadTemplate('manufacturer');
                                                            }
                                                            ?>
                                                            </div>
                                                        </div>

<?php } else { ?>

<div class="wrapper">
                                            <div class="controls">
                                                <span class="quantity-box">
                                               <input type="text" class="quantity-input js-recalculate" name="quantity[]" onblur="check(this);" value="<?php if (isset($this->product->step_order_level) && (int)$this->product->step_order_level > 0) {
echo $this->product->step_order_level;
} else if(!empty($this->product->min_order_level)){
echo $this->product->min_order_level;
}else {
echo '1';
} ?>"/>
                                                </span>
                                                <span class="quantity-controls js-recalculate">
                                                <input type="button" class="quantity-controls quantity-plus" />
                                                <input type="button" class="quantity-controls quantity-minus" />
                                                </span>
                                                <?php // Display the quantity box END ?>
                                                </div>
                                        </div>
<div class="wrapper">
                                                <div class="fright">
                                                       
                                                        <?php
                                                        // Ask a question about this product
                                                            if (VmConfig::get('ask_question', 1) == '1') { ?>
                                                               <div class="ask-a-question">
                                                                    <a class="ask-a-question" href="<?php echo $url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL')?></a>
                                                                    <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 800, y: 750}}" href="<?php echo $url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL')?></a>-->
                                                                    </div>
                                                            <?php } ?>
                                                            <?php
                                                        // Manufacturer of the Product
                                                        if (!empty($this->product->virtuemart_manufacturer_id)) {
                                                          echo  $this->loadTemplate('manufacturer');
                                                        }
                                                        ?>
                                                        </div>
                                                <span class="addtocart-button">
                                                <input type="submit" name="addtocart"  class="addtocart-button cart-click2" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO')?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO')?>" />
                                                </span>
                                            </div>

    <?php
    // Display the add to cart button
    ?>

<?php }  }?>

    <div class="clear"></div>
</div>

<?php // Display the add to cart button END  ?>
<input type="hidden" class="pname" value="<?php echo $this->product->product_name ?>" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $this->product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $this->product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $this->product->virtuemart_category_id ?>" />
    </form>

<div class="clear"></div>
</div>
<?php
} else { ?> <a class="ask-a-question bold" href="<?php echo $this->askquestion_url ?>"><?php echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE')?></a>
<?php
}?>


Помогите, пожалуйста :)
*

bulls

  • Захожу иногда
  • 134
  • 3 / 0
Joomla 1.5  досталась в "наследство" , как всегда все сломано и не работает, буду по тихому переносить на J3, но пока нужно его заново стартануть.
На хосте не работает но нашел в чем причина, вроде как на локалке заработало, но теперь на страницах категорий, (блог категорий),
ошибка такого вида 
Код
Warning: Invalid argument supplied for foreach() in
Z:\home\localhost\www\demoturizm\components\com_content\views\category\view.html.php on line 154
Помогите пожалуйста! Такая ошибка во всех категриях, да еще бывшие разработчики или те кто после них поддерживал сайт изменили админку, не могу посмотреть версию Joomla. Заглянул в libraries\joomla\version.php , пишет
Код
var $RELEASE 	= '1.5';
var $DEV_STATUS = 'Stable';
var $DEV_LEVEL = '22';
из чего делаю вывод версия 1.5.22
*

Aalexandrion

  • Осваиваюсь на форуме
  • 42
  • 0 / 0
Если можно помочь и мне.

Вот такая вот ошибочка на главной страничке:

Warning: Invalid argument supplied for foreach() in /home/p*****/www/*****.ru/modules/mod_aidanews2/helper.php on line 937

Сам модуль Айданьюз я удалил, то есть этой папке и файла в указанном месте нет. Не могу понять откуда такая ошибочка выскакивает.
*

Aalexandrion

  • Осваиваюсь на форуме
  • 42
  • 0 / 0
У меня проблема сама решилась, хз как, warning сам исчез :)
*

crosstet

  • Новичок
  • 1
  • 0 / 0
Приветствую всех! Помогите пожалуйста решить проблему, после добавления и сохранения продукта в joomlakassa вылетает ошибка:1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `catid` = 11 ORDER BY ordering' at line 3 SQL=SELECT Array,Array FROM WHERE `catid` = 11 ORDER BY ordering а внутри формы пишет Warning: Invalid argument supplied for foreach() in /homepages/31/d533085358/htdocs/clickandbuilds/Joomla/MyCMS/libraries/joomla/database/driver.php on line 1490 вот ссылка на сам файл driver.php  https://www.dropbox.com/s/glzsoj7l9l67sga/driver.php Заранее всем очень благодарен!
*

KARATIST

  • Новичок
  • 2
  • 0 / 0
Ошибка возникает иногда на сайте. Подскажите проблему. Спасибо

Warning: Invalid argument supplied for foreach() in ...../articles.php on line 486

Warning: Invalid argument supplied for foreach() in ...../zenj17contethelper.php on line 158
No comntent assigned to be displayed

Первый файл
Код
<?php
/**
 * @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;

jimport('joomla.application.component.modellist');

/**
 * This models supports retrieving lists of articles.
 *
 * @package Joomla.Site
 * @subpackage com_content
 * @since 1.6
 */
class ContentModelArticles extends JModelList
{

/**
* Constructor.
*
* @param array An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'catid', 'a.catid', 'category_title',
'state', 'a.state',
'access', 'a.access', 'access_level',
'created', 'a.created',
'created_by', 'a.created_by',
'ordering', 'a.ordering',
'featured', 'a.featured',
'language', 'a.language',
'hits', 'a.hits',
'publish_up', 'a.publish_up',
'publish_down', 'a.publish_down',
'images', 'a.images',
'urls', 'a.urls',
);
}

parent::__construct($config);
}

/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState($ordering = 'ordering', $direction = 'ASC')
{
$app = JFactory::getApplication();

// List state information
$value = JRequest::getUInt('limit', $app->getCfg('list_limit', 0));
$this->setState('list.limit', $value);

$value = JRequest::getUInt('limitstart', 0);
$this->setState('list.start', $value);

$orderCol = JRequest::getCmd('filter_order', 'a.ordering');
if (!in_array($orderCol, $this->filter_fields)) {
$orderCol = 'a.ordering';
}
$this->setState('list.ordering', $orderCol);

$listOrder =  JRequest::getCmd('filter_order_Dir', 'ASC');
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) {
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);

$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();

if ((!$user->authorise('core.edit.state', 'com_content')) &&  (!$user->authorise('core.edit', 'com_content'))){
// filter on published for those who do not have edit or edit.state rights.
$this->setState('filter.published', 1);
}

$this->setState('filter.language', $app->getLanguageFilter());

// process show_noauth parameter
if (!$params->get('show_noauth')) {
$this->setState('filter.access', true);
}
else {
$this->setState('filter.access', false);
}

$this->setState('layout', JRequest::getCmd('layout'));
}

/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . serialize($this->getState('filter.published'));
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.featured');
$id .= ':' . $this->getState('filter.article_id');
$id .= ':' . $this->getState('filter.article_id.include');
$id .= ':' . serialize($this->getState('filter.category_id'));
$id .= ':' . $this->getState('filter.category_id.include');
$id .= ':' . serialize($this->getState('filter.author_id'));
$id .= ':' . $this->getState('filter.author_id.include');
$id .= ':' . serialize($this->getState('filter.author_alias'));
$id .= ':' . $this->getState('filter.author_alias.include');
$id .= ':' . $this->getState('filter.date_filtering');
$id .= ':' . $this->getState('filter.date_field');
$id .= ':' . $this->getState('filter.start_date_range');
$id .= ':' . $this->getState('filter.end_date_range');
$id .= ':' . $this->getState('filter.relative_date');

return parent::getStoreId($id);
}

/**
* Get the master query for retrieving a list of articles subject to the model state.
*
* @return JDatabaseQuery
* @since 1.6
*/
function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);

// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.title_alias, a.introtext, ' .
'a.checked_out, a.checked_out_time, ' .
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
// use created if modified is 0
'CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, ' .
'a.modified_by, uam.name as modified_by_name,' .
// use created if publish_up is 0
'CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up,' .
'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' .
'a.hits, a.xreference, a.featured,'.' '.$query->length('a.fulltext').' AS readmore'
)
);

// Process an Archived Article layout
if ($this->getState('filter.published') == 2) {
// If badcats is not null, this means that the article is inside an archived category
// In this case, the state is set to 2 to indicate Archived (even if the article state is Published)
$query->select($this->getState('list.select', 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END AS state'));
}
else {
// Process non-archived layout
// If badcats is not null, this means that the article is inside an unpublished category
// In this case, the state is set to 0 to indicate Unpublished (even if the article state is Published)
$query->select($this->getState('list.select', 'CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state'));
}

$query->from('#__content AS a');

// Join over the frontpage articles.
if ($this->context != 'com_content.featured') {
$query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id');
}

// Join over the categories.
$query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias');
$query->join('LEFT', '#__categories AS c ON c.id = a.catid');

// Join over the users for the author and modified_by names.
$query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author");
$query->select("ua.email AS author_email");

$query->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
$query->join('LEFT', '#__users AS uam ON uam.id = a.modified_by');

// Join on contact table
$subQuery = $db->getQuery(true);
$subQuery->select('contact.user_id, MAX(contact.id) AS id, contact.language');
$subQuery->from('#__contact_details AS contact');
$subQuery->where('contact.published = 1');
$subQuery->group('contact.user_id, contact.language');
$query->select('contact.id as contactid' );
$query->join('LEFT', '(' . $subQuery . ') AS contact ON contact.user_id = a.created_by');

// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias');
$query->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');

// Join on voting table
$query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count');
$query->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');

// Join to check for category published state in parent categories up the tree
$query->select('c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published');
$subquery = 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
$subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
$subquery .= 'WHERE parent.extension = ' . $db->quote('com_content');

if ($this->getState('filter.published') == 2) {
// Find any up-path categories that are archived
// If any up-path categories are archived, include all children in archived layout
$subquery .= ' AND parent.published = 2 GROUP BY cat.id ';
// Set effective state to archived if up-path category is archived
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END';
}
else {
// Find any up-path categories that are not published
// If all categories are published, badcats.id will be null, and we just use the article state
$subquery .= ' AND parent.published != 1 GROUP BY cat.id ';
// Select state to unpublished if up-path category is unpublished
$publishedWhere = 'CASE WHEN badcats.id is null THEN a.state ELSE 0 END';
}
$query->join('LEFT OUTER', '(' . $subquery . ') AS badcats ON badcats.id = c.id');

// Filter by access level.
if ($access = $this->getState('filter.access')) {
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN ('.$groups.')');
$query->where('c.access IN ('.$groups.')');
}

// Filter by published state
$published = $this->getState('filter.published');

if (is_numeric($published)) {
// Use article state if badcats.id is null, otherwise, force 0 for unpublished
$query->where($publishedWhere . ' = ' . (int) $published);
}
elseif (is_array($published)) {
JArrayHelper::toInteger($published);
$published = implode(',', $published);
// Use article state if badcats.id is null, otherwise, force 0 for unpublished
$query->where($publishedWhere . ' IN ('.$published.')');
}

// Filter by featured state
$featured = $this->getState('filter.featured');
switch ($featured)
{
case 'hide':
$query->where('a.featured = 0');
break;

case 'only':
$query->where('a.featured = 1');
break;

case 'show':
default:
// Normally we do not discriminate
// between featured/unfeatured items.
break;
}

// Filter by a single or group of articles.
$articleId = $this->getState('filter.article_id');

if (is_numeric($articleId)) {
$type = $this->getState('filter.article_id.include', true)? '= ' : '<> ';
$query->where('a.id '.$type.(int) $articleId);
}
elseif (is_array($articleId)) {
JArrayHelper::toInteger($articleId);
$articleId = implode(',', $articleId);
$type = $this->getState('filter.article_id.include', true)? 'IN' : 'NOT IN';
$query->where('a.id '.$type.' ('.$articleId.')');
}

// Filter by a single or group of categories
$categoryId = $this->getState('filter.category_id');

if (is_numeric($categoryId)) {
$type = $this->getState('filter.category_id.include', true)? '= ' : '<> ';

// Add subcategory check
$includeSubcategories = $this->getState('filter.subcategories', false);
$categoryEquals = 'a.catid '.$type.(int) $categoryId;

if ($includeSubcategories) {
$levels = (int) $this->getState('filter.max_category_levels', '1');
// Create a subquery for the subcategory list
$subQuery = $db->getQuery(true);
$subQuery->select('sub.id');
$subQuery->from('#__categories as sub');
$subQuery->join('INNER', '#__categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt');
$subQuery->where('this.id = '.(int) $categoryId);
if ($levels >= 0) {
$subQuery->where('sub.level <= this.level + '.$levels);
}

// Add the subquery to the main query
$query->where('('.$categoryEquals.' OR a.catid IN ('.$subQuery->__toString().'))');
}
else {
$query->where($categoryEquals);
}
}
elseif (is_array($categoryId) && (count($categoryId) > 0)) {
JArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
if (!empty($categoryId)) {
$type = $this->getState('filter.category_id.include', true)? 'IN' : 'NOT IN';
$query->where('a.catid '.$type.' ('.$categoryId.')');
}
}

// Filter by author
$authorId = $this->getState('filter.author_id');
$authorWhere = '';

if (is_numeric($authorId)) {
$type = $this->getState('filter.author_id.include', true)? '= ' : '<> ';
$authorWhere = 'a.created_by '.$type.(int) $authorId;
}
elseif (is_array($authorId)) {
JArrayHelper::toInteger($authorId);
$authorId = implode(',', $authorId);

if ($authorId) {
$type = $this->getState('filter.author_id.include', true)? 'IN' : 'NOT IN';
$authorWhere = 'a.created_by '.$type.' ('.$authorId.')';
}
}

// Filter by author alias
$authorAlias = $this->getState('filter.author_alias');
$authorAliasWhere = '';

if (is_string($authorAlias)) {
$type = $this->getState('filter.author_alias.include', true)? '= ' : '<> ';
$authorAliasWhere = 'a.created_by_alias '.$type.$db->Quote($authorAlias);
}
elseif (is_array($authorAlias)) {
$first = current($authorAlias);

if (!empty($first)) {
JArrayHelper::toString($authorAlias);

foreach ($authorAlias as $key => $alias)
{
$authorAlias[$key] = $db->Quote($alias);
}

$authorAlias = implode(',', $authorAlias);

if ($authorAlias) {
$type = $this->getState('filter.author_alias.include', true)? 'IN' : 'NOT IN';
$authorAliasWhere = 'a.created_by_alias '.$type.' ('.$authorAlias .
')';
}
}
}

if (!empty($authorWhere) && !empty($authorAliasWhere)) {
$query->where('('.$authorWhere.' OR '.$authorAliasWhere.')');
}
elseif (empty($authorWhere) && empty($authorAliasWhere)) {
// If both are empty we don't want to add to the query
}
else {
// One of these is empty, the other is not so we just add both
$query->where($authorWhere.$authorAliasWhere);
}

// Filter by start and end dates.
$nullDate = $db->Quote($db->getNullDate());
$nowDate = $db->Quote(JFactory::getDate()->toSql());

$query->where('(a.publish_up = '.$nullDate.' OR a.publish_up <= '.$nowDate.')');
$query->where('(a.publish_down = '.$nullDate.' OR a.publish_down >= '.$nowDate.')');

// Filter by Date Range or Relative Date
$dateFiltering = $this->getState('filter.date_filtering', 'off');
$dateField = $this->getState('filter.date_field', 'a.created');

switch ($dateFiltering)
{
case 'range':
$startDateRange = $db->Quote($this->getState('filter.start_date_range', $nullDate));
$endDateRange = $db->Quote($this->getState('filter.end_date_range', $nullDate));
$query->where('('.$dateField.' >= '.$startDateRange.' AND '.$dateField .
' <= '.$endDateRange.')');
break;

case 'relative':
$relativeDate = (int) $this->getState('filter.relative_date', 0);
$query->where($dateField.' >= DATE_SUB('.$nowDate.', INTERVAL ' .
$relativeDate.' DAY)');
break;

case 'off':
default:
break;
}

// process the filter for list views with user-entered filters
$params = $this->getState('params');

if ((is_object($params)) && ($params->get('filter_field')!= 'hide') && ($filter = $this->getState('list.filter'))) {
// clean filter variable
$filter = JString::strtolower($filter);
$hitsFilter = intval($filter);
$filter = $db->Quote('%'.$db->escape($filter, true).'%', false);

switch ($params->get('filter_field'))
{
case 'author':
$query->where(
'LOWER( CASE WHEN a.created_by_alias > '.$db->quote(' ').
' THEN a.created_by_alias ELSE ua.name END ) LIKE '.$filter.' '
);
break;

case 'hits':
$query->where('a.hits >= '.$hitsFilter.' ');
break;

case 'title':
default: // default to 'title' if parameter is not valid
$query->where('LOWER( a.title ) LIKE '.$filter);
break;
}
}

// Filter by language
if ($this->getState('filter.language')) {
$query->where('a.language in ('.$db->quote(JFactory::getLanguage()->getTag()).','.$db->quote('*').')');
$query->where('(contact.language in ('.$db->quote(JFactory::getLanguage()->getTag()).','.$db->quote('*').') OR contact.language IS NULL)');
}

// Add the list ordering clause.
$query->order($this->getState('list.ordering', 'a.ordering').' '.$this->getState('list.direction', 'ASC'));
$query->group('a.id, a.title, a.alias, a.title_alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, a.created, a.modified, a.modified_by, uam.name, a.publish_up, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.fulltext, a.state, a.publish_down, badcats.id, c.title, c.path, c.access, c.alias, uam.id, ua.name, ua.email, contact.id, parent.title, parent.id, parent.path, parent.alias, v.rating_sum, v.rating_count, c.published, c.lft, a.ordering, parent.lft, fp.ordering, c.id, a.images, a.urls');
return $query;
}

/**
* Method to get a list of articles.
*
* Overriden to inject convert the attribs field into a JParameter object.
*
* @return mixed An array of objects on success, false on failure.
* @since 1.6
*/
public function getItems()
{
$items = parent::getItems();
$user = JFactory::getUser();
$userId = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();

// Get the global params
$globalParams = JComponentHelper::getParams('com_content', true);

// Convert the parameter fields into objects.
foreach ($items as &$item)
{
$articleParams = new JRegistry;
$articleParams->loadString($item->attribs);

// Unpack readmore and layout params
$item->alternative_readmore = $articleParams->get('alternative_readmore');
$item->layout = $articleParams->get('layout');

$item->params = clone $this->getState('params');

// For blogs, article params override menu item params only if menu param = 'use_article'
// Otherwise, menu item params control the layout
// If menu item is 'use_article' and there is no article param, use global
if ((JRequest::getString('layout') == 'blog') || (JRequest::getString('view') == 'featured')
|| ($this->getState('params')->get('layout_type') == 'blog')) {
// create an array of just the params set to 'use_article'
$menuParamsArray = $this->getState('params')->toArray();
$articleArray = array();

foreach ($menuParamsArray as $key => $value)
{
if ($value === 'use_article') {
// if the article has a value, use it
if ($articleParams->get($key)!= '') {
// get the value from the article
$articleArray[$key] = $articleParams->get($key);
}
else {
// otherwise, use the global value
$articleArray[$key] = $globalParams->get($key);
}
}
}

// merge the selected article params
if (count($articleArray) > 0) {
$articleParams = new JRegistry;
$articleParams->loadArray($articleArray);
$item->params->merge($articleParams);
}
}
else {
// For non-blog layouts, merge all of the article params
$item->params->merge($articleParams);
}

// get display date
switch ($item->params->get('list_show_date'))
{
case 'modified':
$item->displayDate = $item->modified;
break;

case 'published':
$item->displayDate = ($item->publish_up == 0)? $item->created : $item->publish_up;
break;

default:
case 'created':
$item->displayDate = $item->created;
break;
}

// Compute the asset access permissions.
// Technically guest could edit an article, but lets not check that to improve performance a little.
if (!$guest) {
$asset = 'com_content.article.'.$item->id;

// Check general edit permission first.
if ($user->authorise('core.edit', $asset)) {
$item->params->set('access-edit', true);
}
// Now check if edit.own is available.
elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
// Check for a valid user and that they are the owner.
if ($userId == $item->created_by) {
$item->params->set('access-edit', true);
}
}
}

$access = $this->getState('filter.access');

if ($access) {
// If the access filter has been set, we already have only the articles this user can view.
$item->params->set('access-view', true);
}
else {
// If no access filter is set, the layout takes some responsibility for display of limited information.
if ($item->catid == 0 || $item->category_access === null) {
$item->params->set('access-view', in_array($item->access, $groups));
}
else {
$item->params->set('access-view', in_array($item->access, $groups) && in_array($item->category_access, $groups));
}
}
}

return $items;
}
public function getStart()
{
return $this->getState('list.start');
}
}

Второй
Код
<?php
/**
 * @package     Zen Tools
 * @subpackage  Zen Tools
 * @author      Joomla Bamboo - design@joomlabamboo.com
 * @copyright   Copyright (c) 2012 Joomla Bamboo. All rights reserved.
 * @license     GNU General Public License version 2 or later
 * @version     1.8.0
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.filesystem.path');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');

require_once JPATH_SITE . '/modules/mod_zentools/includes/zentoolshelper.php';
require_once JPATH_SITE . '/components/com_content/models/articles.php';
require_once JPATH_SITE . '/components/com_content/helpers/route.php';

abstract class ModZentoolsHelper
{
    public static function getList(&$params, $id, $handleImages = false)
    {
        // Get the dbo
        $db = JFactory::getDbo();
        // Word Count
        $wordCount  = $params->get( 'wordCount','');
        $titlewordCount = $params->get( 'titlewordCount','');
        $strip_tags = $params->get('strip_tags',0);
        $titleSuffix = $params->get('titleSuffix','');
        $tags   = $params->get( 'allowed_tags','');

        // Image Size and container, remove px if user entered
        $responsiveimages = $params->get('responsiveimages');
        $resizeImage = $params->get('resizeImage',1);
        $option = $params->get( 'option', 'crop');
        $img_width = str_replace('px', '', $params->get( 'image_width','170'));
        $img_height = str_replace('px', '', $params->get( 'image_height','85'));

        $thumb_width = str_replace('px', '', $params->get( 'thumb_width','20'));
        $thumb_height = str_replace('px', '', $params->get( 'thumb_height','20'));

        // Other Params
        $dateFormat     = $params->get('dateFormat', 'j M, y');
        $dateString     = $params->get('dateString', 'DATE_FORMAT_LC3');
        $translateDate      = $params->get('translateDate', '0');
        $showCategory = $params->get('showCategory',1);
        $link   = $params->get( 'link','');
        $textsuffix = $params->get( 'textsuffix','');

        // Lightbox
        $modalVideo = $params->get('modalVideo');
        $modalText = $params->get('modalText');
        $modalTitle = $params->get('modalTitle');
        $modalMore = $params->get('modalMore');


        // J2.5 and altlink
        if (version_compare(JVERSION, '2.5', '<'))
        {
            $joomla25 = 0;
            $altlink = 0;
        }
        else
        {
            $joomla25 = 1;
            $altlink = $params->get('altlink');
        }

        // Get an instance of the generic articles model
        if (version_compare(JVERSION, '3.0', '<'))
        {
            $model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
        }
        else
        {
            $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
        }

        // Set application parameters in model
        $app = JFactory::getApplication();
        $appParams = $app->getParams();
        $model->setState('params', $appParams);

        // Set the filters based on the module params
        $model->setState('list.start', 0);
        $model->setState('list.limit', (int) $params->get('count', 5));
        $model->setState('filter.published', 1);

        // Access filter
        $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
        $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
        $model->setState('filter.access', $access);

        // Category filter
        if($params->get( 'joomlaContentSource') =="items") {
            $model->setState('filter.article_id', $params->get('artids', array()));
            $model->setState('filter.article_id.include', $params->get('article_filtering_type', 1));
        }
        else {
            $model->setState('filter.category_id', $params->get('catid', array()));
        }

        //  Featured switch
        switch ($params->get('show_front'))
        {
            case '2':
                $model->setState('filter.featured', 'only');
                break;
            case '0':
                $model->setState('filter.featured', 'hide');
                break;
            case '1':
                $model->setState('filter.featured', 'show');
                break;
        }


        // Filter by language
        $model->setState('filter.language',$app->getLanguageFilter());

        // Ordering
        $model->setState('list.ordering', $params->get('ordering', 'a.ordering'));
        $model->setState('list.direction', $params->get('ordering_direction', 'ASC'));

        $items = $model->getItems();

        //if($jiexists) {
                   // Get Jinfinity Parameters
        //           $jiparams = JComponentHelper::getParams('com_jinfinity');
        //           $idprefix = $jiparams->get('fields_idprefix', 0);
                   // #Jinfinity - Get Field List
        //           $fieldlist = JinfinityModelFields::getFields();
        //      }
        //       foreach ($items as $item) {
        //           $item->slug = $item->id.':'.$item->alias;
        //           $item->catslug = $item->catid.':'.$item->category_alias;
        //           $item->text = $item->introtext;
        //           $item->modaltext = $item->text;

        //           if($jiexists) {
                       // #Jinfinity - Map fields to item object
        //               if(isset($item->fields) && $item->fields!=null) {
        //                   $item->fields = json_decode($item->fields, true);
        //                   foreach($item->fields as $fid=>$value) {
        //                       if(isset($fieldlist[$fid])) {
        //                           $field = $fieldlist[$fid];
        //                           $fvar = ($idprefix==1)? $fid.'-'.$field->name : $field->name;
        //                           if($fvar!=null) $item->{$fvar} = JinfinityModelFields::displayField($item, $field, $fieldlist);
        //                       }
        //                   }
        //               }
        //           }
        // }

        foreach ($items as $item) {
            $item->slug = $item->id.':'.$item->alias;
            $item->catslug = $item->catid.':'.$item->category_alias;
            $item->text = $item->introtext;



            /**
            *
            * Joomla 1.7 & 2.5 Image Logic
            *
            **/

            if ($handleImages) {
                // Grab the intro_image in Joomla 2.5 or otherwise use the introtext image.
                if(version_compare( JVERSION, '2.5', '>=' ))
                {
                    $images = json_decode($item->images);
                }
                else
                {
                    $images = "";
                }

                if(isset($images->image_intro) and !empty($images->image_intro)) {
                    $item->image = $images->image_intro;
                }

                else {
                    $imghtml= $item->introtext;
                    $imghtml .= "alt='...' title='...' />";
                    $pattern = '/<img[^>]+src[\\s=\'"]';
                    $pattern .= '+([^"\'>\\s]+)/is';
                    if(preg_match(
                    $pattern,
                    $imghtml,
                    $match))
                    $item->image = "$match[1]";
                    else $item->image = "";
                }


                $item->modaltext = $item->text;

                $modalImage = $params->get('modalImage',0);
                if($modalImage) {
                    $item->modaltext = preg_replace('/<img(.*)>/i','',$item->modaltext,1);
                }




                /**
                *
                * Joomla 1.7 & Joomla 2.5 Resize Images
                *
                **/
                $item->thumb="";
                $item->modalimage="";

                if(!empty($item->image))
                {
                    // Sets the modal image
                    $item->modalimage = $item->image;
                    $item->imageOriginal = $item->image;

                    if ($resizeImage) {
                            $item->image = ZenToolsHelper::handleRemoteImage($item->image);
                            $item->image = ZenToolsHelper::getResizedImage($item->image, $img_width, $img_height, $option);

                            if($responsiveimages) {
                                $item->imageTiny = ZenToolsHelper::getResizedImage($item->image, ($img_width /5), ($img_height / 5), $option);
                                $item->imageXSmall = ZenToolsHelper::getResizedImage($item->image, ($img_width /3), ($img_height / 3), $option);
                                $item->imageSmall = ZenToolsHelper::getResizedImage($item->image, ($img_width /2), ($img_height / 2), $option);
                                $item->imageMedium = ZenToolsHelper::getResizedImage($item->image, ($img_width /1.25), ($img_height / 1.25), $option);
                                $item->imageDefault = ZenToolsHelper::getResizedImage($item->image, ($img_width), ($img_height), $option);
                                $item->imageLarge = ZenToolsHelper::getResizedImage($item->image, ($img_width * 1.25), ($img_height * 1.25), $option);
                                if($item->imageLarge == $item->image) {
                                    $item->imageLarge = $item->imageDefault;
                                }
                                $item->imageXLarge = ZenToolsHelper::getResizedImage($item->image, ($img_width *1.75), ($img_height * 1.75), $option);

                                if($item->imageXLarge == $item->image) {
                                    $item->imageXLarge = $item->imageDefault;
                                }
                            }
                    }
                    else {
                        if($responsiveimages) {
                            $item->image = ZenToolsHelper::handleRemoteImage($item->image);

                            list($width, $height) = getimagesize($item->image);
                            $item->imageTiny = ZenToolsHelper::getResizedImage($item->image, ($width /5), ($height / 5), 'exact');
                            $item->imageXSmall = ZenToolsHelper::getResizedImage($item->image, ($width /3), ($height / 3), 'exact');
                            $item->imageSmall = ZenToolsHelper::getResizedImage($item->image, ($width /2), ($height / 2), 'exact');
                            $item->imageMedium = ZenToolsHelper::getResizedImage($item->image, ($width /1.5), ($height / 1.25), 'exact');
                            $item->imageDefault = ZenToolsHelper::getResizedImage($item->image, ($width), ($height), 'exact');
                            $item->imageLarge = ZenToolsHelper::getResizedImage($item->image, ($width * 1.25), ($height * 1.25), $option);
                            if($item->imageLarge == $item->image) {
                                $item->imageLarge = $item->imageDefault;
                            }

                            $item->imageXLarge = ZenToolsHelper::getResizedImage($item->image, ($width *1.75), ($height * 1.75), $option);

                            if($item->imageXLarge == $item->image) {
                                $item->imageXLarge = $item->imageDefault;
                            }
                        }
                    }

                    $item->thumb = ZenToolsHelper::getResizedImage($item->image, $thumb_width, $thumb_height,  $option);
                }
            }
            else {
                $item->image = '';
            }


            /**
            *
            * Joomla 1.7 & Joomla 2.5 Title
            *
            **/
            $titletext = htmlspecialchars( $item->title );
            $item->modaltitle = htmlspecialchars( $item->title );
            $item->title = $titlewordCount ? ZenToolsHelper::truncate($titletext, $titlewordCount, $titleSuffix) : $titletext;


            /**
            *
            * Joomla Links
            *
            **/
            if ($access || in_array($item->access, $authorised)) {
                // We know that user has the privilege to view the article
                if($link == 0) {
                    $item->link = '';
                    $item->closelink = '';
                }
                elseif($link == 1) {
                    if($modalMore or $modalTitle or $modalText) {
                        $item->link = 'href="#data'.$item->id.'"';
                    }
                    else {
                        $item->link = 'href="'.$item->modalimage.'" title="'.$item->modaltitle.'"';
                    }
                    $item->closelink = '</a>';
                    $item->lightboxmore = 'href="'.JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)).'"';
                }
                else {
                    $item->link = 'href="'.JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)).'"';
                    $item->closelink = '</a>';
                }


                /**
                *
                * Joomla 2.5  Alternate Links
                *
                **/

                $item->newlink = 0;

                if($joomla25) {
                    $links = json_decode($item->urls);

                    if(isset($links->urla) and !empty($links->urla)) {
                        $item->altlink = 'href="'.$links->urla.'"';
                        $item->newlink = 1;
                    }
                    else {
                        $item->altlink = $item->link;
                        $item->newlink = 0;
                    }
                }

                /**
                *
                * Joomla 1.7 & Joomla 2.5 Category Name and Link
                *
                **/

                if ($showCategory) {
                    $item->catlink = '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug).'&layout=blog').'">';
                } else {
                    $item->link = '<a href="'.JRoute::_('index.php?option=com_user&view=login').'">';
                }

                $item->category = $item->category_title;
            }
            else {
                $item->link = JRoute::_('index.php?option=com_users&view=login');
            }



            /**
            *
            * Joomla 1.7 & Joomla 2.5 Metakeywords
            *
            **/

            $item->metakey = $item->metakey;




            /**
            *
            * Joomla 1.7 & Joomla 2.5 Intro Text
            *
            **/

            if($strip_tags) {
                $introtext = $strip_tags ? ZenToolsHelper::_cleanIntrotext($item->introtext,$tags) : $item->introtext;
            }
            else {
                $introtext = $item->introtext;
            }

            if($wordCount !=="-1") {
                $tempintro = false;
                $item->text = $wordCount ? ZenToolsHelper::truncate($introtext, $wordCount, $textsuffix) : $tempintro;
            }
            else {
                $item->text = $item->introtext;
                $item->text = $item->text.$textsuffix;
            }



            /**
            *
            * Joomla 1.7 & Joomla 2.5 Full Text
            *
            **/

            //$item->fulltext = $item->fulltext;




            /**
            *
            * Joomla 1.7 & Joomla 2.5 Date
            *
            **/

            if (!$translateDate) {
                $item->date = date($dateFormat,  (strtotime($item->created)));
            }
            else {
                $item->date = JHTML::_('date', $item->created, JText::_(''.$dateString.''));
            }


            /**
            *
            * Joomla 1.7 & Joomla 2.5 IDs
            *
            **/

            $item->id = $item->id;

            /**
            *
            * null
            *
            **/

            $item->video = false;


        }

        return $items;
    }
}
*

eugene.k

  • Новичок
  • 5
  • 0 / 0
Добрый день. Я пытаюсь сделать вывод доп. полей из k2 в другом компоненте. Я добавил строки вывода доп полей и получил ошибку Warning: Invalid argument supplied for foreach() in www\components\com_mymaplocations\views\locations\tmpl\default.php on line 603
строки, что я добавил, это собственно те на которые он и ругается, а ошибка не пойму в чем. Подскажите, пожалуйста, в чем дело
Спойлер
[свернуть]
*

passer

  • Завсегдатай
  • 1013
  • 75 / 3
Вот это $item->extra_fields дает null.
*

eugene.k

  • Новичок
  • 5
  • 0 / 0
вы не подскажите, как сделать, чтоб он выводил поля?
вот более полный код, но ошибка остается, но уже такая
Fatal error: Call to a member function get() on a non-object in www\components\com_mymaplocations\views\locations\tmpl\default.php on line 602
 
Код
<?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?>
 <!-- Item extra fields -->
 <div class="catItemExtraFields">
  <h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4>
  <ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value): ?>
<li class="<?php echo ($key%2)? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
   <div class="clr"></div>
 </div>
 <?php endif; ?>
« Последнее редактирование: 16.07.2014, 20:53:31 от eugene.k »
*

dj_lucky

  • Осваиваюсь на форуме
  • 18
  • 0 / 0
Добрый день всем! Помогите, пожалуйста.
При поиске по сайту появляется предупреждение: Warning: Invalid argument supplied for foreach() in .................../templates/parfum/html/com_k2/templates/generic.php on line 37

Вот, собственно код:
         
Спойлер
[свернуть]

Буду очень благодарен за помощь!
*

hresvelg

  • Новичок
  • 2
  • 0 / 0
Люди, у меня такая проблема. Я выгрузил сайт на хост и появилась такая ошибка
Warning: Invalid argument supplied for foreach() in /home/u550203487/public_html/libraries/joomla/access/access.php on line 409
В файле следующее:
Код
foreach ($db->loadAssocList() as $level)
{
self::$viewLevels[$level['id']] = (array) json_decode($level['rules']);

На локалхосте все нормально, не могу понять, как это могло произойти, выгрузил 2 раза уже. Шаблон с квикстарта с Kunena форумом и virtuemart'ом. Единственный косяк, который я заметил это то, что в бд некоторые таблицы с префиксом bak_
*

hresvelg

  • Новичок
  • 2
  • 0 / 0
С этой ошибкой разобрался. Сейчас вместо сайта белый лист с пунктами меню в столбик и ошибкой:

Parse error: syntax error, unexpected '}' in /home/u550203487/public_html/plugins/system/helix/features/totop.php on line 1
*

oleg-great

  • Захожу иногда
  • 50
  • 0 / 0
Люди Хелп.
При выводе модуля "Новые товары" в позиции "Слайдер" выдает пару ошибок:
Warning: Invalid argument supplied for foreach() in /templates/it_theshop2/html/mod_jshopping_latest_products/default.php on line 28
Warning: Invalid argument supplied for foreach() in /templates/it_theshop2/html/mod_jshopping_latest_products/default.php on line 37

Код:
Спойлер
[свернуть]
*

liliya1919

  • Захожу иногда
  • 87
  • 0 / 0
Здравствуйте. Такая проблема Warning: Invalid argument supplied for foreach() in ....../......./........../templates/sj_live/menusys/ytmenubase.php on line 92

Но только в Chrome и IE, в Сафари(мак) - все без ошибок.
В чем проблема подскажите пожалуйста!
Код
// set active items
foreach ($path as $id => $item){
if (isset($k[$id])){
$k[$id]->set('active', 1);
}
}
« Последнее редактирование: 29.12.2014, 08:39:37 от liliya1919 »
*

liliya1919

  • Захожу иногда
  • 87
  • 0 / 0
Проблема решена.
Не знаю верно или нет, но помогло! Оказывается надо было добавить массив $path = array();
Было:
Код
// set active items
foreach ($path as $id => $item){
if (isset($k[$id])){
$k[$id]->set('active', 1);
       }
}
Стало:
Код
// set active items
        $path = array();
foreach ($path as $id => $item){
if (isset($k[$id])){
$k[$id]->set('active', 1);
}
}
            
*

passer

  • Завсегдатай
  • 1013
  • 75 / 3
Не верно. Не стоит переменную обнулять. А вдруг в ней что-то полезное было.
*

robert

  • Живу я здесь
  • 4974
  • 457 / 20
Лучше поставить проверку:
Код: php-brief
if(is_array($path)){
foreach ($path as $id => $item){
if (isset($k[$id])){
$k[$id]->set('active', 1);
}
}
Не будь паразитом, сделай что-нибудь самостоятельно!
*

ivrovi

  • Новичок
  • 6
  • 0 / 0
Здравствуйте.
Всех с наступившим Новым годом.
Появилось предупреждение и не выводится настройка формы компонента Sexy Contact Form (сайт скрыл что бы не считали рекламой)
Warning: Invalid argument supplied for foreach() in *****************administrator/components/com_sexycontactform/views/sexyforms/tmpl/default.php on line 268

<?php
         $n = count($this->items);
         foreach ($this->items as $i => $item) :
            $ordering   = $listOrder == 'sp.ordering';
            ?>
Так же при выборе шаблона вместо списка шаблонов появляется:
Warning: Invalid argument supplied for foreach() in ******************administrator/components/com_sexycontactform/views/templates/tmpl/default.php on line 200

<?php
         $n = count($this->items);
         foreach ($this->items as $i => $item) :
            ?>
Подскажите как исправить. Заранее благодарен.
*

super111

  • Осваиваюсь на форуме
  • 36
  • 0 / 1
Помогите разобраться пожалуйста

Выдает следующую ошибку
warning invalid argument supplied for foreach () in

ссылается на вторую строку кода (выделена жирным)

<?php
foreach($this->searchfields as $fsearch) {
 $title = $this->field->showFieldTitle($this->catid,$fsearch);
echo "<tr><td>".htmlspecialchars($title)."</td><td>";
 $this->field->showFieldSearch($fsearch,$this->catid,null);
echo "</td></tr>";
}?>         
*

bad_jaguar

  • Новичок
  • 2
  • 0 / 0
как указать папку с фото, если выдаёт вот это:

Предупреждение
JFolder: :folder: Путь ведёт не к каталогу. Путь: Z:\home\gelbarik.biz\www\Z:\home\gelbarik.biz\www\images\headers


Warning: Invalid argument supplied for foreach() in Z:\home\gelbarik.biz\www\administrator\components\com_media\models\manager.php on line 71


вот код

Код: php
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_media
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Media Component Manager Model
 *
 * @package     Joomla.Administrator
 * @subpackage  com_media
 * @since       1.5
 */
class MediaModelManager extends JModelLegacy
{
public function getState($property = null, $default = null)
{
static $set;

if (!$set)
{
$input = JFactory::getApplication()->input;

$folder = $input->get('folder', '', 'path');
$this->setState('folder', $folder);

$fieldid = $input->get('fieldid', '');
$this->setState('field.id', $fieldid);

$parent = str_replace("\\", "/", dirname($folder));
$parent = ($parent == '.')? null : $parent;
$this->setState('parent', $parent);
$set = true;
}

return parent::getState($property, $default);
}

/**
* Image Manager Popup
*
* @param string $listFolder The image directory to display
* @since 1.5
*/
function getFolderList($base = null)
{
// Get some paths from the request
if (empty($base))
{
$base = COM_MEDIA_BASE;
}
//corrections for windows paths
$base = str_replace(DIRECTORY_SEPARATOR, '/', $base);
$com_media_base_uni = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE);

// Get the list of folders
jimport('joomla.filesystem.folder');
$folders = JFolder::folders($base, '.', true, true);

$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_MEDIA_INSERT_IMAGE'));

// Build the array of select options for the folder list
$options[] = JHtml::_('select.option', "", "images");

'71 line' foreach ($folders as $folder)
{
$folder = str_replace($com_media_base_uni, "", str_replace(DIRECTORY_SEPARATOR, '/', $folder));
$value = substr($folder, 1);
$text = str_replace(DIRECTORY_SEPARATOR, "/", $folder);
$options[] = JHtml::_('select.option', $value, $text);
}

// Sort the folder list array
if (is_array($options))
{
sort($options);
}

// Get asset and author id (use integer filter)
$input = JFactory::getApplication()->input;
$asset = $input->get('asset', 0, 'integer');

// For new items the asset is a string. JAccess always checks type first
// so both string and integer are supported.
if ($asset == 0)
{
$asset = $input->get('asset', 0, 'cmd');
}

$author = $input->get('author', 0, 'integer');

// Create the drop-down folder select list
$list = JHtml::_('select.genericlist', $options, 'folderlist', 'size="1" onchange="ImageManager.setFolder(this.options[this.selectedIndex].value, '.$asset.', '.$author.')" ', 'value', 'text', $base);

return $list;
}

function getFolderTree($base = null)
{
// Get some paths from the request
if (empty($base))
{
$base = COM_MEDIA_BASE;
}

$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE.'/');

// Get the list of folders
jimport('joomla.filesystem.folder');
$folders = JFolder::folders($base, '.', true, true);

$tree = array();

foreach ($folders as $folder)
{
$folder = str_replace(DIRECTORY_SEPARATOR, '/', $folder);
$name = substr($folder, strrpos($folder, '/') + 1);
$relative = str_replace($mediaBase, '', $folder);
$absolute = $folder;
$path = explode('/', $relative);
$node = (object) array('name' => $name, 'relative' => $relative, 'absolute' => $absolute);

$tmp = &$tree;
for ($i = 0, $n = count($path); $i < $n; $i++)
{
if (!isset($tmp['children']))
{
$tmp['children'] = array();
}

if ($i == $n - 1)
{
// We need to place the node
$tmp['children'][$relative] = array('data' => $node, 'children' => array());
break;
}

if (array_key_exists($key = implode('/', array_slice($path, 0, $i + 1)), $tmp['children']))
{
$tmp = &$tmp['children'][$key];
}
}
}
$tree['data'] = (object) array('name' => JText::_('COM_MEDIA_MEDIA'), 'relative' => '', 'absolute' => $base);

return $tree;
}
}
*

Spaik

  • Осваиваюсь на форуме
  • 38
  • 0 / 0
Добрый день. У меня схожая проблема. После восстановления хостинга (хостинг не был во время продлен) возникла проблема с компонетом BreezingForms http://prntscr.com/6f3a04, пишет ошибку: Warning: Invalid argument supplied for foreach() in /home/sofron/domains/radugafest.com/public_html/libraries/joomla/database/database/mysql.php on line 375. Просмотрел всю тему, решения не нашел. Что это, путь не может найти или что, как здесь быть.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Ошибки Warning: Invalid argument supplied for foreach() in

Автор CityCat

Ответов: 11
Просмотров: 1880
Последний ответ 22.02.2019, 14:51:06
от CityCat
b2jcontact - warning

Автор Acme

Ответов: 0
Просмотров: 1576
Последний ответ 16.03.2017, 11:28:40
от Acme
Fox Contact не отсылает письма, как решить проблему?

Автор spanchermen

Ответов: 21
Просмотров: 11730
Последний ответ 14.07.2016, 17:40:53
от vipiusss
B2J Contact не отправляет почту и дает ошибку

Автор Klers

Ответов: 0
Просмотров: 1001
Последний ответ 13.06.2016, 12:06:31
от Klers
Опросник MijoPolls выдает ошибку

Автор kostet0007

Ответов: 5
Просмотров: 2653
Последний ответ 19.06.2015, 01:26:23
от voland