0

我正在创建一个 joomla2.5 模块。我想从模块中检索数据传递参数,但我得到了关于标题的错误。下面是我的代码: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' ) );

我的新问题是如何从模块中获取数据传递?

4

1 回答 1

0

为了说明我上面的评论:

$url = $feed->feedurl($url);
                      ^^^^---- $url is not defined at this point

feedurl() 是否返回 $url 值无关紧要。在您调用feedurl() 时,$url您尝试传递给该方法的未定义。所以在 feedurl() 中,你正在做

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

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

    $url = $params->get(feedUrl);
                        ^^^^^^^--- undefined constant
于 2013-04-11T19:36:21.147 回答