2013-01-19 55 views
0

正如你们许多人知道的Joomla 2.5控制器从链接到新的Joomla 2.5控制器

// Create the controller 
$classname = 'mycomponentController'.$controller; 
$controller = new $classname(); 

// Perform the Request task 
$controller->execute(JRequest::getVar('task')); 

// Redirect if set by the controller 
$controller->redirect(); 

改变的东西沿着

// Get an instance of the controller prefixed by the component 
$controller = JController::getInstance('mycomponent'); 

// Perform the Request task 
$controller->execute(JRequest::getCmd('task')); 

// Redirect if set by the controller 
$controller->redirect(); 

现在的Joomla 1.5以及由线使用表格,您可以通过运行链接运行任务

index.php?option=com_mycomponent&controller=specificcontroller&task=randomtask 

但是,这种连接方式不适用于ne w控制器 - 没有人知道如何在Joomla 2.5中设置这个链接的格式,如果你使用的是新控制器?

回答

0

您可以结合任务和控制器,以便它将调用指定控制器的任务。这些将是.(dot)分离。尝试这个 -

index.php?index.php?option=com_mycomponent&view=viewname&task=specificcontroller.randomtask 

更多 - http://docs.joomla.org/JController_and_its_subclass_usage_overview

+0

谢谢!是否需要view = viewname? –

+1

不,它不是... – Elin

+0

Thankyou :)非常感谢 –