Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii Controller cannot find the requested view

Tags:

php

yii

I am encountering this error when rendering "error" view

ApiController cannot find the requested view "error".

All directories are in small letters. I am running Yii on Linux Machine

Sample Code:

class ApiController extends Api
{
    private $api;
    private $placesapikey;

public function __construct()
{
    parent::__construct("Api");
    $uri = explode('=', Yii::app()->request->getQueryString());
    $this->api = end($uri);
    $this->placesapikey = "";

    if ($this->api != Yii::app()->params['apikey'] || $this->api == '')
    {
        $error['data']['title'] = "Un-Authorized Access";
        $error['data']['message'] = "You are not authorized to access or view this area";
        $this->render('error', $error);
        exit;
    }
}
like image 569
Assad Ullah Avatar asked May 25 '12 07:05

Assad Ullah


1 Answers

Try:

$this->render('/api/error', $error);
like image 92
bool.dev Avatar answered Sep 20 '22 13:09

bool.dev