question about task=taskname.action - Joomla! Forum - community, help and support


hello,

i having problems using jcontroller. have studied jcontroller code , found can pass task , action controller via syntax of task=task_name.action_name (earlier have used task=task_name&page=action_name worked fine)

here code of how load controller:

$input = jfactory::getapplication()->input;
$cmd = $input->getstring('task', 'main');
// default they're empty
$task = "";
$action = "";

if(strpos($cmd, ".") !== false)
{
$tsk_act = explode(".", $cmd);
if(sizeof($tsk_act) == 2)
{
$task = $tsk_act[0];
$action = $tsk_act[1];
}
} else{
// there no point there task specified
$task = $cmd;
}

and here how controller loaded

//loading controller
$controller = jcontroller::getinstance($task);
// executing task
$controller->execute($action);
// redirect if set controller
$controller->redirect();

the main problem when there no action specified controller class name jas sometaskcontroller , when action if defined sometaskcontrollersometask.

am missing something?
thank time in advance.

if not specify task on url, component controller default "display", , use current view , models. if specify task on url, @ directory of sub controllers "controllers" , find name of class/object, , @ name of method, example "index.php?option=com_mytask&task=youhaveto.dothis", component controller under controllers folder class/object of type youhaveto, , scan object dothis method. controller execute method.

most not implemented explicitly. admin page create input form name "task" , use javascript populate it's value @ runtime.





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support