Calling specific controller - Joomla! Forum - community, help and support
hi guys,
i have problem. creating new component consists of several views. made mycomponent.php file in components root folder this:
then created controller.php file in root:
then created several views , models , controllers proper these views. problem cannot make joomla call specific controller. example have view called files. in view sub-folder have view.html.php:
and if click on link in template index.php?option=com_mycomponent&view=files loads view , lists files not go through controller mycomponentcontrollerfiles in files.php file in controllers sub-folder. need register task in there. can tell me doing wrong?
thank you
i have problem. creating new component consists of several views. made mycomponent.php file in components root folder this:
code: select all
<?php
defined('_jexec') or die();
jimport('joomla.application.component.controller');
$controller = jcontroller::getinstance('mycomponent');
$controller->execute(jrequest::getvar('task'));
$controller->redirect();
?>
then created controller.php file in root:
code: select all
<?php
defined('_jexec') or die();
jimport('joomla.application.component.controller');
class mycomponentcontroller extends jcontroller{
protected $default_view = 'myview';
public function display()
{
return parent::display();
}
}
?>
then created several views , models , controllers proper these views. problem cannot make joomla call specific controller. example have view called files. in view sub-folder have view.html.php:
code: select all
<?php
defined('_jexec') or die();
jimport('joomla.application.component.view');
class mycomponentviewfiles extends jview{
protected $items;
public function display() {
$this->items = $this->get('items');
$this->addtoolbar();
parent::display();
}
private function addtoolbar(){
//here code
}
}
?>
and if click on link in template index.php?option=com_mycomponent&view=files loads view , lists files not go through controller mycomponentcontrollerfiles in files.php file in controllers sub-folder. need register task in there. can tell me doing wrong?
thank you
Comments
Post a Comment