joomla前台组件的学习总结

1、结构:(组件名为:selfRegistration)

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

        

      joomla前台组件的学习总结_第1张图片

红色为文件夹

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类,可以创建连接操作数据库的函数之类

   


你可能感兴趣的:(Date,function,Class,Access,redirect,Components)