2013-01-19 2 views
0

Как многие из вас знают, контроллер в Joomla 2.5 изменен сСвязывание с новой Joomla 2.5 Controller

// 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 controller - кто-нибудь знает, как отформатировать эту ссылку в Joomla 2.5, если вы используете новый контроллер?

ответ

0

Вы можете комбинировать задачу и контроллер, чтобы он вызывал задачу указанного контроллера. Это будет .(dot) отдельно. попробуйте this-

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 :) очень благодарен –