0
다음은 내 Controller
클래스의 일부 샘플 메서드입니다. 이제 사용자가 New 버튼을 클릭하면 $ task = add가 Controller로 보내지고 add() 메서드가 호출됩니다. 보시다시피 실제로 아무것도하지는 않지만 단지 URL을 만들어 올바른보기로 전달합니다. 이것은 MVC 패턴에서 일을하는 올바른 방법입니까?보기에 Joomla 전달 코드가 ... 올바른 방법입니까?
/**
* New button was pressed
*/
function add() {
$link = JRoute::_('index.php?option=com_myapp&c=apps&view=editapp&cid[]=', false);
$this->setRedirect($link);
}
/**
* Edit button was pressed - just use the first selection for editing
*/
function edit() {
$cid = JRequest::getVar('cid', array(0), '', 'array');
$id = $cid[0];
$link = JRoute::_("index.php?option=com_myapp&c=apps&view=editapp&cid[]=$id", false);
$this->setRedirect($link);
}
weblinks edit() 메서드가 내게 제공하지 않는 것을 알고 있습니까? – jax