Just to clarify for anyone reading this, adding $useTable = false to
the model is not the solution. Mohammad mentioned that he was testing
"the situation in which DB is shut down" and how Cake would handle it.

I've just confirmed with 2.1.3 that the error page comes up ("Internal
error has occurred") but that the header in my view -- just before the
Form->create() line -- is displayed at the top of the page, just as in
Mohammad's example. So it seems like a buffering problem.


On Tue, Sep 18, 2012 at 12:35 PM, Mohammad Naghavi <moham...@gmail.com> wrote:
> lowpass, thats it. the problem is that FormHelper fetches the model data
> inside the view. I don't know why this is the case, but as said, I managed
> to solve the problem but I don't think it should be like that. it will be
> interesting for the Cake developers to know however.
>
> regards,
> Mohammad
>
>
> On Mon, Sep 17, 2012 at 7:41 PM, lowpass <zijn.digi...@gmail.com> wrote:
>>
>> I think I see the problem. It's not that Mohammad is explicitly
>> querying the DB from the View, but that FormHelper is doing so behind
>> the scenes. It fetches the model's schema. In this case the DB is
>> unavailable and it's not being handled well.
>>
>> It's odd that the error message (inside the H4$ tags) is spit out
>> before even the doctype. Perhaps that's a clue as to what's going on.
>>
>>
>> On Sun, Sep 16, 2012 at 12:43 PM, Léo Willian Kölln <leoko...@gmail.com>
>> wrote:
>> > Why there is some DB interaction during the View rendering? You dont
>> > need to do any query "explicitly" on the View file, if you are calling
>> > a method that does some DB interaction you are doing a Query during
>> > the View Context.
>> > If you need some data that comes from model (doesn't matter if it is
>> > from DB or not), do it on the controller, setting variables to output
>> > them on the View.
>> >
>> > Can someone confirm my conclusion?
>> >
>> >
>> > Léo Willian Kölln
>> >
>> >
>> > On Sun, Sep 16, 2012 at 7:19 AM, Mohammad Naghavi <moham...@gmail.com>
>> > wrote:
>> >> 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.digi...@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 <moham...@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+unsubscr...@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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>> >
>> >
>>
>> --
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>>
>> 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+unsubscr...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to