Re: Howto include a View into another View?

2009-10-23 Thread AD7six



On 23 oct, 18:38, jayarjo  wrote:
> Nice.
>
> But I don't quiet get why he is not counting database impact.

What database impact would that be.

Regarding your original question: use elements. If something is hard
to do it's because you're doing it wrong/fighting what cake does for
you.

AD
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-23 Thread jacmoe

If you are using Ajax, just use $this->AutoRender(false); in your
controller.
And you can just use $this->renderElement(someelement) in your view,
if you need a view (which you don't when using the AutoRender(false)
option.

((Take this with grains of salt as I am still wet behind the ears when
it comes to CakePhp programming :P))

On Oct 23, 6:38 pm, jayarjo  wrote:
> Nice.
>
> But I don't quiet get why he is not counting database impact.
>
> On Oct 23, 4:40 pm, robustsolution  wrote:
>
> > Dear @jayarjo
> > just read 
> > thishttp://cakedc.com/eng/developer/mark_story/2009/02/27/benchmarking-re...
>
>
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-23 Thread jayarjo

Nice.

But I don't quiet get why he is not counting database impact.

On Oct 23, 4:40 pm, robustsolution  wrote:
> Dear @jayarjo
> just read 
> thishttp://cakedc.com/eng/developer/mark_story/2009/02/27/benchmarking-re...
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-23 Thread robustsolution

Dear @jayarjo
just read this
http://cakedc.com/eng/developer/mark_story/2009/02/27/benchmarking-requestaction

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-23 Thread jayarjo


Little update:

It looks like $this->render sets $this->hasRendered property to true,
preventing successive renderings. It can be avoided by setting $this-
>hasRendered to false after each call to $this->render method.

And finally you always can simply do: include
('whatever_path_you_need_and damn_it_all');

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-23 Thread jayarjo


I really hate looking into source code, 'cause I'd rather think that
there is everything clean and neat, then look and find out that it is
nowhere cleaner then my own (which I kinda dislike a bit :) But
anyway...

It turned out that there is "render" function included in the View
class, so that resolving the problem like mine is very simple - one
can call 'render' function right from the view. Like this:

render(null, 'ajax', 'test'); ?>

null - will be substituted with current action, 'ajax' will ensure
that view is not wrapped up in layout, and 'test' is the name of the
view file, inside (!) the same action folder!

Clean and perfect.

P.S. Although I feel a bit uncomfortable now, once I got a glimpse of
Cakes internals.


On Oct 23, 11:48 am, jayarjo  wrote:
> @robustsolution
>
> But it is said that requestAction adds unnecessary load on the
> backend, making another http request, isn't that true? If yes, then
> why should anyone need something like that when it's just a matter of
> simple include? It can be though, that I miss some point in what
> you've suggested - I do not feel like being on ground yet when using
> Cake.
>
> @jacmoe, @Lance Willett
>
> Not a bad solution, although pieces still get separated, despite of
> the fact that they are actually one View. I guess that's what I'll
> have to stick to though. Thanks guys.
>
> On Oct 23, 6:44 am, Lance Willett  wrote:
>
> > As jacmoe said, the best practice is to put elements specific to one
> > view into a subfolder named the same as the view. That way you aren't
> > cluttering the elements directory with lots of files, and the element
> > files specific to that view will be easy to find and call.
>
> > Example: if the element belong to /views/users, put it in /views/
> > elements/users/.
>
> > On Oct 22, 4:13 am, jayarjo  wrote:
>
> > > I'm getting a huge View and I'm thinking now of splitting it into
> > > separate pieces and include them into the main View, as I will need
> > > them. I know I can create Elements and include them, but the problem
> > > is that those smaller Views that I'd like to create are specific to
> > > this main View only. So that I'd rather store them inside that folder
> > > named after the Controller of the main View rather then clutter
> > > Elements folder with unnecessary files. Is there any widespread
> > > solution to this? There should be some.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-23 Thread jayarjo

@robustsolution

But it is said that requestAction adds unnecessary load on the
backend, making another http request, isn't that true? If yes, then
why should anyone need something like that when it's just a matter of
simple include? It can be though, that I miss some point in what
you've suggested - I do not feel like being on ground yet when using
Cake.

@jacmoe, @Lance Willett

Not a bad solution, although pieces still get separated, despite of
the fact that they are actually one View. I guess that's what I'll
have to stick to though. Thanks guys.

On Oct 23, 6:44 am, Lance Willett  wrote:
> As jacmoe said, the best practice is to put elements specific to one
> view into a subfolder named the same as the view. That way you aren't
> cluttering the elements directory with lots of files, and the element
> files specific to that view will be easy to find and call.
>
> Example: if the element belong to /views/users, put it in /views/
> elements/users/.
>
> On Oct 22, 4:13 am, jayarjo  wrote:
>
> > I'm getting a huge View and I'm thinking now of splitting it into
> > separate pieces and include them into the main View, as I will need
> > them. I know I can create Elements and include them, but the problem
> > is that those smaller Views that I'd like to create are specific to
> > this main View only. So that I'd rather store them inside that folder
> > named after the Controller of the main View rather then clutter
> > Elements folder with unnecessary files. Is there any widespread
> > solution to this? There should be some.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-22 Thread Lance Willett

As jacmoe said, the best practice is to put elements specific to one
view into a subfolder named the same as the view. That way you aren't
cluttering the elements directory with lots of files, and the element
files specific to that view will be easy to find and call.

Example: if the element belong to /views/users, put it in /views/
elements/users/.

On Oct 22, 4:13 am, jayarjo  wrote:
> I'm getting a huge View and I'm thinking now of splitting it into
> separate pieces and include them into the main View, as I will need
> them. I know I can create Elements and include them, but the problem
> is that those smaller Views that I'd like to create are specific to
> this main View only. So that I'd rather store them inside that folder
> named after the Controller of the main View rather then clutter
> Elements folder with unnecessary files. Is there any widespread
> solution to this? There should be some.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-22 Thread robustsolution

Dear @Jayarjo
If I understand very well your Question, I think you should read a
little bit about requestAction with 'return' extra parameter

On Oct 22, 2:13 pm, jayarjo  wrote:
> I'm getting a huge View and I'm thinking now of splitting it into
> separate pieces and include them into the main View, as I will need
> them. I know I can create Elements and include them, but the problem
> is that those smaller Views that I'd like to create are specific to
> this main View only. So that I'd rather store them inside that folder
> named after the Controller of the main View rather then clutter
> Elements folder with unnecessary files. Is there any widespread
> solution to this? There should be some.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Howto include a View into another View?

2009-10-22 Thread jacmoe

What's wrong with using elements/controller/some_element ?
Or elements/controller/somegroup/another_element ?
I works nicely for my projects :)

On Oct 22, 1:13 pm, jayarjo  wrote:
> I'm getting a huge View and I'm thinking now of splitting it into
> separate pieces and include them into the main View, as I will need
> them. I know I can create Elements and include them, but the problem
> is that those smaller Views that I'd like to create are specific to
> this main View only. So that I'd rather store them inside that folder
> named after the Controller of the main View rather then clutter
> Elements folder with unnecessary files. Is there any widespread
> solution to this? There should be some.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Howto include a View into another View?

2009-10-22 Thread jayarjo

I'm getting a huge View and I'm thinking now of splitting it into
separate pieces and include them into the main View, as I will need
them. I know I can create Elements and include them, but the problem
is that those smaller Views that I'd like to create are specific to
this main View only. So that I'd rather store them inside that folder
named after the Controller of the main View rather then clutter
Elements folder with unnecessary files. Is there any widespread
solution to this? There should be some.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---