MVC를 통해 Joomla2.5 구성 요소를 만들려고합니다. 진입 점에서 task = jump에서 view.xml.php에 정의 된 mydisplay() 메소드로 컨트롤러를 연결하려고합니다. 감사.컨트롤러 작업에서 view-method 호출 joomla
/ROOT/components/com_api/views/api/view.xml.php
<?php
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* XML View class for the Api Component
*/
class ApiViewApi extends JView
{
// Overwriting JView display method
function mydisplay($tpl = null)
{
//echo JRequest::getVar('task');
//$this->get('Ister');
// Assign data to the view
$this->msg = $this->get('xCredentials');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Display the view
parent::display($tpl);
}
}
?>
ROOT/컴포넌트/com_api/api.php (엔트리 포인트 컨트롤러)
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by Api
$controller = JController::getInstance('Api');
// Perform the Request task
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
?>
ROOT/components/com_api/controller.php (컨트롤러가 작업 = 점프)
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/**
* Api Component Controller
*/
class ApiController extends JController
{
function jump()
{
//parent::display();
/* invoke mydisplay method from view.xml.php, located in views*/
}
}
어떻게 작업 = 점프를 실행 한 후 view.xml.php에서 mydisplay() 메서드를 호출합니까?