我正在创建一个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' ) );
我的新问题是如何从模块获得数据传递?
为了说明我上面的评论:
$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