1

I would like to set up a default view. If my component gets called by using administrator/index.php?option=com_bestia&view= I'm getting the error:

404 View not found [Name, Typ, Präfix]: bestia, html, bestiaView

com_banners does it better: administrator/index.php?option=com_banners&view= results in showing the first page of banners component.

This is my controller:

class BestiaController extends JControllerLegacy {

protected $default_view         =           'cpanel';

/**
 * display function.
 * 
 * @access public
 * @param bool $cachable (default: false)
 * @param bool $urlparams (default: false)
 * @return void
 */
public function display($cachable = false, $urlparams = false) 
{
    require_once JPATH_COMPONENT . '/helpers/bestia.php';

    $view       =   $this->input->get('view', 'cpanel');
    $layout     =   $this->input->get('layout', 'default');
    $id         =   $this->input->getInt('id');

    // Check for edit form.
    if ($layout == 'edit' && !$this->checkEditId('com_bestia.edit.'.$view, $id))
    {
        // Somehow the person just went to the form - we don't allow that.
        $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
        $this->setMessage($this->getError(), 'error');
        $this->setRedirect(JRoute::_('index.php?option=com_bestia&view='.$view.'s', false));

        return false;
    }

    parent::display($cachable, $urlparams);

    return $this;
}
3

I think your view files are missing or view class is named incorrectly (correct is [Prefix]View[Viewname]).

If I change the name of

administrator/components/com_banners/views/ to /viewx/

I get the following error:

An error has occurred.
500 View not found [name, type, prefix]: banners, html, bannersView

Switch it back to /views/ - and error goes away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.