Hi,
-- I do no query from inside the View, I just call this:
$this->Form->create();
inside my view. the problem is that every thing inside view before this line comes as a part of the exception handling output.
what I think is that because I don't call any db or model related actions inside the controller, the exception is thrown and caught at the point that form creation is triggered, where the cake tries to connect to db.
anyway I managed to solve my problem using a custom error controller. but I think it is good for core developers to know the situation.
regards,
MN
On Fri, Sep 14, 2012 at 7:57 PM, lowpass <zijn.digital@gmail.com> wrote:
Are you making DB queries from within the View? You should be doing so
from the model or controller. Then, once the controller has all the
data it requires, it passes it to View to be rendered.
> --
On Fri, Sep 14, 2012 at 4:43 AM, Mohammad Naghavi <mohamnag@gmail.com> wrote:
> Hi,
> I'm dealing with an action of a controller, in which no db interaction is
> required until it comes to rendering the view. inside the view, again first
> half of the view doesn't need any db interactions until a form creation is
> started somewhere in the middle. I'm preparing my app for production
> environment so I came to the point to make it clean. there I tested the
> situation in which DB is shut down and pointed the browser to that action,
> what I expected was a single internal error page, but what I got was a half
> rendered view, which was accompanied with the rendered error layout.
> something like following:
>
> <h4 class="warning">
> some message here
> </h4>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
> /> <title>
> CakePHP: the rapid development php framework:
> Errors </title>
> <link href="/itbs/favicon.ico" type="image/x-icon" rel="icon" /><link
> href="/itbs/favicon.ico" type="image/x-icon" rel="shortcut icon" /><link
> rel="stylesheet" type="text/css" href="/itbs/css/cake.generic.css" /></head>
> <body>
> <div id="container">
>
> ...
>
>
> now my question is that how to remove this first part of half rendered view?
> I tried to set $this->response->body(' '); on beforeRender of the
> appController for the case that controller->name is CakeError but it didn't
> work, any other suggestions?
>
> regards,
> MN
>
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
--
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
No comments:
Post a Comment