Error "Warning: Invalid argument..."

Professional eCommerce VirtueMart Joomla template with responsive design discussion forum.
Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Fri Jun 05, 2015 10:23 am
Reply with quote
Report this post
Hi, over my article it shows:

Warning: Invalid argument supplied for foreach() in /home/zepdtago/public_html/templates/gk_instyle/html/com_content/article/default.php on line 13

How can I remove this? In local I can modify PHP Errors, but now I posted the web on a server and I only have a cpanel.

Thank you very much
User avatar
Senior Boarder

GK User
Sat Jun 06, 2015 12:05 pm
Reply with quote
Report this post
Hello,

in the default.php file please change:

Code: Select all
if(count($attribs)) {
    foreach($attribs as $key => $value) {
        if($value != null) {
           $params->set($key, $value);
        }
    }
}


to:

Code: Select all
if($attribs && count($attribs)) {
    foreach($attribs as $key => $value) {
        if($value != null) {
           $params->set($key, $value);
        }
    }
}
User avatar
Administrator

GK User
Tue Jun 09, 2015 9:29 am
Reply with quote
Report this post
Sorry but, where is default.php? In template gk_instyle?

Thank you very much
User avatar
Senior Boarder

GK User
Wed Jun 10, 2015 11:58 am
Reply with quote
Report this post
Yes, I mean:

templates/gk_instyle/html/com_content/article/default.php
User avatar
Administrator

GK User
Wed Jun 10, 2015 12:41 pm
Reply with quote
Report this post
It shows me this:

// Create shortcuts to some parameters.
$params = $this->item->params;
$images = json_decode($this->item->images);
$attribs = json_decode($this->item->attribs);

foreach($attribs as $key => $value) {
if($value != null) {
$params->set($key, $value);
}
}

$canEdit = $this->item->params->get('access-edit');
$urls = json_decode($this->item->urls);
$user = JFactory::getUser();
User avatar
Senior Boarder

GK User
Wed Jun 10, 2015 1:08 pm
Reply with quote
Report this post
My mistake - I've pasted two times the same code - please replace:

Code: Select all
foreach($attribs as $key => $value) {
        if($value != null) {
           $params->set($key, $value);
        }
    }


to:

Code: Select all
if($attribs && count($attribs)) {
    foreach($attribs as $key => $value) {
        if($value != null) {
           $params->set($key, $value);
        }
    }
}
User avatar
Administrator

GK User
Wed Jun 10, 2015 6:29 pm
Reply with quote
Report this post
Thank you very much
User avatar
Senior Boarder


cron