Here are some sample methods from my Controller
class. Now when the user clicks the New button $task=add is sent to the Controller and the add() method is called. As you can see it does not really do anything, it just creates a url and forwards it off to the correct view. Is this the correct way of doing things in the MVC pattern?
/**
* 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);
}