我正在构建一个 joomla 2.5 模块,我想从模块参数访问数据传递,但我收到以下错误:致命错误:调用非对象上的成员函数 get() 我的代码如下:
助手.php
class modFeedGrabber
{
function feedurl( $params ){
return $params->get('feedUrl');
}
}
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();
require( JModuleHelper::getLayoutPath( 'mod_feedGrabber' ) );
mod_feedGrabber.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="2.5.0" client="site" method="install">
<name>Scroll Feed</name>
<author>Josiah Gerald</author>
<version>1.0.0</version>
<date>03-04-2013</date>
<description>A simple feed scroller.</description>
<files>
<filename>mod_feedGrabber.xml</filename>
<filename module="mod_feedGrabber">mod_feedGrabber.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
<folder>tmpl</folder>
</files>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="feedUrl"
type="url"
size="50"
label="Feed URL"
description="Enter the url of the feed" />
</fieldset>
</fields>
</config>
</extension>
默认的.php
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<div id='feed' class="<?php echo $module_sfx; ?>"><?php echo $url; ?>
</div>