如何在Joomla控制器中显示视图?

时间:2013-06-27 18:13:19

标签: joomla

我有一个上传到文件夹的脚本,我希望在上传完成后显示视图,无论是否成功。

/component
  /admin/
    /views/
      /components/
        view.html.php
        /tmpl/
          default.php
          modal.php // I want to load and output this file from controller.php
    component.php
    controller.php
 /site/

我想在我的控制器中做这样的事情

 $view = $this->getView(/* params for modal.php to load*/); //get the view
 $this->view->display();

谢谢

1 个答案:

答案 0 :(得分:4)

尝试使用:

$view = $this->getView( 'components', 'html' );
$view->setLayout('modal');
$view->display();

JRequest::setVar('view', 'components');
JRequest::setVar('layout', 'modal');