Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8503919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:53:12+00:00 2026-06-11T01:53:12+00:00

I am using cakephp, I working on Error Handling I have follow http://book.cakephp.org/1.3/en/view/1188/Error-Handling I

  • 0

I am using cakephp, I working on Error Handling

I have follow http://book.cakephp.org/1.3/en/view/1188/Error-Handling

I have create AppError My code is

app/app_error.php

<?php

    class AppError extends ErrorHandler {


        function error404() {
            //$this->controller->set('file', $params['file']);
            $this->_outputMessage('error404');
        }

    }
    ?>

I am calling this error404 from my controller

function userprofile($id = null) {
        $user = $this->Session->read('user');
        if($id != $user['User']['id'])
        {
            $this->cakeError('error404');
        }
}

but I found Erro
Fatal error: Call to undefined method UsersController::cakeError() in D:\wamp\www\survey\app\Controller\UsersController.php on line 318

I miss some thing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:53:14+00:00Added an answer on June 11, 2026 at 1:53 am

    I think you are using CakePHP 1.3 and extending ErrorHandler defined here :

    ....\cake\libs\error.php
    

    and as per this error404 is defined as :

    function error404($params) {
        extract($params, EXTR_OVERWRITE);
    
        if (!isset($url)) {
            $url = $this->controller->here;
        }
        $url = Router::normalize($url);
        $this->controller->header("HTTP/1.0 404 Not Found");
        $this->controller->set(array(
            'code' => '404',
            'name' => __('Not Found', true),
            'message' => h($url),
            'base' => $this->controller->base
        ));
        $this->_outputMessage('error404');
    }
    

    in your …./app/app_error.php you have defined it as

    function error404() {
            //$this->controller->set('file', $params['file']);
            $this->_outputMessage('error404');
    }
    

    and in php such type of method overloading is not allowed. I think you have got your answer.

    what you can do is that you can create your own function in your extended AppError class and then pass error name or template name in that like

    function customeError($errorMessage){
         $this->_outputMessage($errorMessage);
    } 
    

    and then on basis of different template names you can put conditions in _outputMessage() function and redirect user to different pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a CMS using CakePHP and I want to create a
I have a RESTful API set up and working with CakePHP using mapResources() and
Using CakePHP 1.3 , I have a (working) form that has dynamically created form
I am working on development of an application using CakePHP framework. We all have
i am using cakephp 1.3 ...it was working like charm in server ,i copied
I am using Authorize.net payment module(AIM) with my cakephp framework. Payment functionality is working
Im using cakephp 2.0 and i have data submitted that i want to cleanup,
I'm using cakephp 2.1.3 and I have a table Ingredients and a table IngredientAliases
Using CakePHP 1.3, I have the following layout: /srv/www/_cakephp13/ /app/ /cake/ /plugins/ /vendors/ etc...
I am using cakePHP rating plugin with Flowplayer. I have customized the Flowplayer using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.