致命错误:在joomla 2.5中的非对象上调用成员函数get()

时间:2013-04-11 19:28:36

标签: php joomla

我正在创建一个joomla2.5模块。 我想从模块中检索数据传递参数,但是我得到了about title错误。以下是我的代码: helper.php

class modFeedGrabber
{
    function feedurl(){
        $url = $params->get('feedUrl');
        return $url;
    }
    function maxCount(){
        $maxcount = $params->get('maxCount');
        return $maxcount;
    }
    function showDesc(){
        return $params->get('showDesc');
    }
    function showPubDate(){
        return $params->get('showPubDate');
    }
    function targetLink(){
        return $params->get('titleLinkTarget');
    }
    function descChar(){
        return $params->get('descCharacterLimit');
    }
    function fx(){
        return $params->get('fx');
    }
    function delay(){
        return $params->get('delay');
    }
    function timeout(){
        return $params->get('timeout');
    }
    function module_sfx(){
        return $params->get('moduleclass_sfx');
    }
}

mod_feedGrabber.php

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

$sitebase = JPATH_BASE;
$doc =& JFactory::getDocument();

// Include the syndicate functions only once
require_once( dirname(__FILE__).DS.'/helper.php' );
$feed = new modFeedGrabber();
$url = $feed->feedurl($url);
$maxcount = $feed->maxcount($maxcount);
require( JModuleHelper::getLayoutPath( 'mod_feedGrabber' ) );

我的新排除是如何从模块传递数据?

1 个答案:

答案 0 :(得分:0)

为了说明我上面的评论:

$url = $feed->feedurl($url);
                      ^^^^---- $url is not defined at this point
如果feedurl()返回$ url值,则

无关紧要。当您 CALL feedurl()时,您尝试传递给方法的$url未定义。在feedurl()中,你正在做

$url = $params->get(...);
       ^^^^^^^---the $url you passed in to the method, which is null/undefined

然后,当然,还有其他问题:

    $url = $params->get(feedUrl);
                        ^^^^^^^--- undefined constant