Save function and SEF-urls

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
deepthoughts
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Tue Sep 27, 2005 1:12 pm
Location: The northern part of Sweden (Piteå)

Save function and SEF-urls

Post by deepthoughts » Mon Jan 14, 2008 11:05 pm

I'm having some serious troubles... I've created a component that registered user can submit inforation to from the frontend. This works fine and dandy when SEF is not turned on but as soon as I turn it on I get:

Code: Select all

500 - View not found
At the bottom it says:

Code: Select all

View not found [name, type, prefix]: frontpage,html,callistoView
Do I read that correctly that it's looking for a view called frontpage? If so, why?

In the component.php-file I have this:

Code: Select all

$controller->registerDefaultTask('display');
and the task looks like this:

Code: Select all

 function display () {

      $document =& JFactory::getDocument();
      $viewName = JRequest::getVar('view','events');

      $viewType = $document->getType();
      $view = &$this->getView($viewName, $viewType);


      $model = &$this->getModel('default' );


          if (!JError::isError( $model )) {
            $view->setModel( $model, true );
          }
          $view->setLayout("default");
          $view->display();

    }
This works perfectly with and without SEF when using a link from the menu.

My save function looks like this:

Code: Select all

 function save () {

		$option = JRequest::getCmd('option');
		$itemid = JRequest::getCmd('itemid');

		$post = JRequest::get('post');

		$row =& JTable::getInstance('Callisto', 'Table');

        if (!$row->bind($post)) {
          return JError::raiseWarning(500, $row->getError());
        }
        if (!$row->store()) {
          return JError::raiseWarning(500, $row->getError());
        }
        $this->setRedirect('index.php?option=' . $option . '&itemid=' . $itemid);
        $this->setMessage('Händelse inlagd');

    }
It still saves the entry in the database despite throwing this error. So basically it stores the database and then gives an error about the view.

Could someone help figure out whats wrong?

(The most annoying part is that I want to believe that it has worked before with SEF-urls but something has change I can for my life not figure out what.)
Stefan Nitsche
stefan_at_nitsche_dot_se

Post Reply