5

Site error detected. Details: http://sucuri.net/malware/php-error-fatal-error?v6
Fatal error: Call to a member function get() on a non-object in /home/project/public_html/components/com_sectioncategoryarticlelist/views/sectioncategoryarticlelist/view.html.php on line 28

Can anyone help me to resolve it?

<?php
/**
 * @Project    SectionCategoryArticleList
 * @author     Mathias Hortig
 * @package    SectionCategoryArticleList
 * @copyright  Copyright (C) 2011-2012 tuts4you.de . All rights reserved.
 * @license   http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
*/

// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

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


class SectionCategoryArticleListViewSectionCategoryArticleList extends JViewLegacy
{
    function display($tpl = null)
    {
        $document = &JFactory::getDocument();
        $document->addStyleSheet(JURI::root(true).'/components/com_sectioncategoryarticlelist/css/sectioncategoryarticlelist.css');
    $document->addScript(JURI::root(true).'/components/com_sectioncategoryarticlelist/js/sectioncategoryarticlelisttoggle.js');
        $model = &$this->getModel();
        $menu = JSite::getMenu()->getActive();
        $params = $menu->params;

        $this->assignRef( 'HTML', $model->GetCategories($params->get('linkcategories',1), $params->get('usetoggle',0), $params->get('defaulttoggle',0)));
        $this->assignRef( 'pretext', $params->get('pretext'));
        $this->assignRef( 'posttext', $params->get('posttext'));
        $this->assignRef( 'headline', $params->get('headline'));

        parent::display($tpl);
    }
}
3
  • This is old legacy code, so am I right in assuming this is on a Joomla 1.5 site?
    – Lodder
    Commented Nov 7, 2016 at 17:06
  • No, it could be a 2.x site, or even an early 3.x site, if the developer wasn't keeping current with PHP. Later versions of PHP would throw up at calling a non-static method statically, but PHP hasn't always been that picky.
    – Arlen
    Commented Aug 14, 2019 at 13:31
  • @Rakhi, you now have the privilege to vote in our current moderator election. Please exercise your new democratic privilege. Commented May 6, 2021 at 4:48

2 Answers 2

1

Looks like the variable $params isn't getting set.

Could be several reasons this is happening, among them that there isn't a menu item set in the current URL.

As @lodder noted, this is old code. The mechanism involving the static call of getMenu from the site application was deprecated years ago; nobody should be using it anymore. (Don't remember precisely when it happened, but I think it was nearly a decade ago. I think it may have even been deprecated before this code was written, given the copyright date.)

Overall, my advice would be first to get this thing updated to something more nearly current, and if that's not possible to look at what the

JSite::getMenu()->getActive()

is returning. I suspect that's at the heart of the error message.

0

There are no details provided behind your link (404 error). I just see an old component php-error, maybe because of the Joomla 1.5 code inside. Have a look at the Joomla Documentation.

Probablly the developer should review his component again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.