view的工作很简单,就是获取数据,用assignRef传递给模板。

 view 代码如下:

<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:modules/
 * @license    GNU/GPL
*/

// no direct access

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

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

/**
 * HTML View class for the HelloWorld Component
 *
 * @package    HelloWorld
 */

class HelloViewHello extends JView
{
    function display($tpl = null)
    {
        $greeting = "Hello World!";
        $this->assignRef( 'greeting', $greeting );

        parent::display($tpl);
    }
}
?>

相关文章:

  • 2021-10-14
  • 2021-09-14
  • 2021-10-01
  • 2021-08-07
  • 2022-01-16
  • 2021-05-23
  • 2021-09-23
  • 2021-08-15
猜你喜欢
  • 2021-11-01
  • 2021-07-08
  • 2021-06-04
  • 2022-03-08
  • 2021-10-13
  • 2021-07-16
  • 2022-02-06
相关资源
相似解决方案