Joomla学习,模块如何创建-3
好了。xml文件创建完毕,我们该进行下一步了,创建.php文件。
我们来看一下mod_latestnews.php。
/**
* @version $Id: mod_latestnews.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access'); // 不允许直接调用
// Include the syndicate functions only once
require_once (dirname(__FILE__).DS.'helper.php'); // 此处引用模型文件
$list = modLatestNewsHelper::getList($params); // 调用模型文件内的类,获得参数列表
require(JModuleHelper::getLayoutPath('mod_latestnews')); // 调用显示模块
我们来看一下mod_latestnews.php。
/**
* @version $Id: mod_latestnews.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access'); // 不允许直接调用
// Include the syndicate functions only once
require_once (dirname(__FILE__).DS.'helper.php'); // 此处引用模型文件
$list = modLatestNewsHelper::getList($params); // 调用模型文件内的类,获得参数列表
require(JModuleHelper::getLayoutPath('mod_latestnews')); // 调用显示模块
