Advertisement
oscarholmedo

Joomla 3 How to set a multi controller view and model

Mar 16th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2.     defined('_JEXEC') or die('Restricted access');
  3.     class MycontrollerControllerSubcontrollername extends JControllerLegacy{
  4.         //controllers/subcontrollername
  5.         public function taskname($cachable = false){
  6.             $view = & $this->getView( 'viewname', 'html' );
  7.             // views/viewname/
  8.            
  9.             $view->setLayout( 'layout' );
  10.             // views/viewname/tmpl/layout.php
  11.            
  12.             if ($model = & $this->getModel( 'modelname' )) $view->setModel( $model, true );
  13.             //models/modelname.php
  14.            
  15.             $view->display();
  16.             //parent::display($cachable); //ignore this now
  17.         }
  18.     }
  19. ?>
  20.  
  21. //url   option=com_mycontroller&task=subcontroller.taskname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement