Friday, August 27, 2010

Re: $this->cakeError("error401") won't render my error401.ctp

this u will need...

function error401($params)
{
                        //$this->controller->layout = "error_layout"; //if u want to change layout
$this->controller->set($params); //set variables
$this->_outputMessage("error401"); //output error element
}

--
LP,
Tilen Majerle http://majerle.eu


2010/8/27 Tilen Majerle <tilen.majerle@gmail.com>
i'm not sure...but u need to do this

class AppError extends ErrorHandler {
       function error401() {
            $this->_outputMessage("error401"); //where error401 is your template name
       }
}

--
LP,
Tilen Majerle http://majerle.eu


2010/8/27 psybear83 <psybear83@gmail.com>

Hi all

I want to display a 401 error, so I created an app/app_error.php file
with the following content:

<?php

class AppError extends ErrorHandler {
       function error401() {

       }
}

?>

And I created a view app/views/errors/error401.ctp with the following
content:

<h2><?php echo $name; ?></h2>
<p class="error">
       <strong><?php __('Error'); ?>: </strong>
       <?php echo sprintf(__("You are not authorized to %s.", true),
"<strong>'{$message}'</strong>")?>
</p>

Then I call the error using:

$this->cakeError("error401");

But I'm still getting the default 401 error... (or at least not my
own!)

What could be the problem here?

Thanks a lot for help
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: