PHP errors on Single Article pages

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
Wed Jun 13, 2012 11:36 pm
Reply with quote
Report this post
I get the following errors on Single Article pages:

Notice: Undefined offset: 0 in /var/www/tim1/templates/gk_fashion/html/com_content/article/default.php on line 38

Notice: Undefined variable: template_config in /var/www/tim1/templates/gk_fashion/html/com_content/article/default.php on line 41

Notice: Trying to get property of non-object in /var/www/tim1/templates/gk_fashion/html/com_content/article/default.php on line 41

I've read previous posts about "disabling PHP error reporting" & i've tried to do that through htaccess with no luck - any other suggestions?
User avatar
Fresh Boarder

GK User
Wed Jun 13, 2012 11:45 pm
Reply with quote
Report this post
my mistake - forgot to enable .htaccess on my server :lol:

I wonder though, is it normal for me to have to disable PHP error reporting in the first place?
User avatar
Fresh Boarder

GK User
Thu Jun 14, 2012 10:28 am
Reply with quote
Report this post
In general for Joomla! use you should disable displaying errors, but additionally in the file html/com_content/articles/default.php please change fragment:

Code: Select all
// OpenGraph support$template_config = new JConfig();
$uri = JURI::getInstance();
$article_attribs = json_decode($this->item->attribs, true);

$og_title = $this->escape($this->item->title);
$og_type = 'article';
$og_url = $cur_url;
if (version_compare( JVERSION, '1.8', 'ge' ) && isset($images->image_fulltext) and !empty($images->image_fulltext)) {     $og_image = $uri->root() . htmlspecialchars($images->image_fulltext);
     $pin_image = $uri->root() . htmlspecialchars($images->image_fulltext);
} else {
     $og_image = '';
     preg_match('/src="([^"]*)"/', $this->item->text, $matches);
     
     $pin_image = $uri->root() . substr($matches[0], 5,-1);
}


to:

Code: Select all
// OpenGraph support
$template_config = new JConfig();
$uri = JURI::getInstance();
$article_attribs = json_decode($this->item->attribs, true);

$og_title = $this->escape($this->item->title);
$og_type = 'article';
$og_url = $cur_url;
if (version_compare( JVERSION, '1.8', 'ge' ) && isset($images->image_fulltext) and !empty($images->image_fulltext)) {     $og_image = $uri->root() . htmlspecialchars($images->image_fulltext);
     $pin_image = $uri->root() . htmlspecialchars($images->image_fulltext);
} else {
     $og_image = '';
     preg_match('/src="([^"]*)"/', $this->item->text, $matches);
     
     if(isset($matches[0])) {
        $pin_image = $uri->root() . substr($matches[0], 5,-1);
     }
}
User avatar
Administrator


cron