您的位置:首页 > 其它

joomla前台组件的学习总结

2009-07-13 16:49 375 查看
1、结构:(组件名为:selfRegistration)

这是joomla前台组件必须的基本结构



红色为文件夹

2、主要文件的骨干代码

selfRegistration.php

<?php
/**
* @date       2009-07-15
* @author     Pandar
* @package    selfRestration
* @subpackage Components
* @link
* @license    GNU/GPL
*/

defined('_JEXEC') or die('Restricted access');

// Require the base controller
require_once (JPATH_COMPONENT.DS.'controller.php');

// Require specific controller if requested
if($controller = JRequest::getVar('controller')) {
require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
}

// Create the controller
$classname	= 'SelfRegistrationController'.$controller;
$controller = new $classname( );

// Perform the Request task
$controller->execute( JRequest::getVar('task'));

// Redirect if set by the controller
$controller->redirect();

?>


controller.php

<?php
/**
* @date       2009-07-15
* @author     Pandar
* @package    selfRestration
* @subpackage Components
* @link
* @license    GNU/GPL
*/

jimport('joomla.application.component.controller');

class SelfRegistrationController extends JController
{

function display()
{
parent::display();
}

}
?>


view.html.php(这个是从models类里面传递参数到defined.php)

<?php
jimport('joomla.application.component.view');
class SelfRegistrationViewSelfRegistration extends JView
{
function display($tpl=NULL)
{
$model=&$this->getModel();
$this->assignRef('greeting',$greeting);
$this->assignRef('pandar',$pandar);
parent::display($tpl);
}
}
?>


defined.php主要是网页布局的

models下的selfRegistration.php包含了models类,可以创建连接操作数据库的函数之类
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: