0
我正在創建一個joomla2.5模塊。 我想從模塊中檢索數據傳遞參數,但是得到關於標題的錯誤。下面是我的代碼: helper.php致命錯誤:調用joomla2.5中的一個非對象的成員函數get()
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'));
我的新quetion是我怎樣才能得到的數據從模塊通過了嗎?
無處你在你的代碼定義'$ url',讓你有效地考取給你的方法一個'null'值。 – 2013-04-11 19:30:29
$ url是在方法函數feedurl()中定義和賦值的() – jking 2013-04-11 19:32:06
@ user1230116 - 該方法需要一個參數,並且正在傳入「$ url」,這是underfined。然後它會使用這個未定義的參數的get方法,這就是爲什麼你會得到一個錯誤。 – andrewsi 2013-04-11 19:33:56