开发者

CakePHP Using requestHandler and isAjax [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

I have the following code (I'm also calling the RequestHandler component) in my con开发者_C百科troller:

function popup()
    {   
        if ($this->requestHandler->isAjax())
        {
            // jazz
        }
        else
        {
            $this->cakeError('error403');
        }
    }

The idea is that if a user tries to access the page directly then they will get a 403 or if it's loaded in a popup via AJAX then all be fine. However I get the following errors:

Notice (8): Undefined property: PagesController::$requestHandler [APP/controllers/pages_controller.php, line 103]
Fatal error: Call to a member function isAjax() on a non-object in /Users/cameron/Sites/cameron/app/controllers/pages_controller.php on line 103

and line 103 is the if statement

Any ideas what the problem is? Thanks


$this->RequestHandler->isAjax();

Just a typo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜