I am building a MVC patterned component. It works fine apart from the fact whenever I execute any task it does not get redirected to the redirect url instead gives a 500 error
a brief background of the problem,
My component's name is com_googlemap
My model's name is createmapmark
component's directory structure look like My controller look like this ..
Code: Select all
class googlemapController extends JController
{
function display()
{
$document =& JFactory::getDocument();
$viewo = JRequest::getVar('view');
$viewName = JRequest::getVar('task',$viewo);
$viewType = $document->getType();
$view =& $this->getView($viewName,$viewType);
$model = $this->getModel($viewName,'Modelgooglemap'); //I don't really understand this function..
if(!JError::isError($model)){
$view->setModel($model,true);
}
$view->setLayout('default');
$view->display();
}
}
Code: Select all
$task = JRequest::getCmd('task');
switch( $task ){
case 'addmapmark':
addmapmark();
break;
default:
break;
}
// Create the controller
$controller = new googlemapController();
// Perform the Request task
$controller->execute( JRequest::getCmd('task'));
// Redirect if set by the controller
$controller->redirect();
function addmapmark()
{
global $mainframe;
/*binding and storing data to db here */
$link = JRoute::_( 'index.php?option=com_googlemap&view=createmapmark' );
$mainframe->redirect( $link, "Thank you for adding your fishing spot! keep sharing!!");
}
?>
and the firefox url look like
Code: Select all
http://www.myfishmaps.com/index.php?option=com_googlemap&view=createmapmark
and i have error message
500 - View not found [name, type, prefix]: googlemap,html,googlemapView