In a nutshell:

You can think of a layout as being the container for your pages
(views)

ie. Your actions in your controllers create views which are displayed
within your layout

So, to take your example:

Homepage (layout: default.ctp, controller: pages, action: home)

(pages controller is a little different to other controllers, its
designed to output static pages)

Upload page (layout: upload_layout.ctp, controller: file, action:
upload)

The file controller rendereed the upload view (based on the action)
and then squirts it into the upload_layout).

The position in the layout of where the view is rendered is fixed by
adding <?php echo $controler_for_layout ?> to the html in the layout

Note, in this example, you probably don't need a special
upload_layout.ctp, you can probably use the default.

On Feb 18, 5:15 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello Samuel,
>
> I was looking more of a theory that what is the thoratical difference
> between the two. In my knowledge and the example that i gave it looks to me
> that i can use them interchangeably.
>
> Thanks.
>
> On Feb 18, 2008 10:25 PM, Samuel DeVore <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > you might just refresh your memory by reading
> >http://manual.cakephp.org/appendix/blog_tutorial
>
> > On Feb 18, 2008 9:52 AM, Novice Programmer <[EMAIL PROTECTED]>
> > wrote:
> > > Hello All,
>
> > > Its quite been a long since i started using cake but this question is
> > still
> > > pestering. What is the difference between a page and a layout in cake?
> > Lets
> > > say that on home page i have a link to the upload page. What woudl the
> > > design look like? I have default.thtml in the layouts folder and then I
> > > design another layout upload.thtml for the uploads page. Now here is
> > > question: What should the structure look like? is uploads a page or it
> > > should be a layout?
>
> > > Please help
>
> > > --
> > > Thanks & Regards,
> > > Novice (http://ishuonweb.wordpress.com/).
>
> > --
> > --
> > (the old fart) the advice is free, the lack of crankiness will cost you
>
> > - its a fine line between a real question and an idiot
>
> >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
> >http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
> >http://blog.samdevore.com/cakephp-pages/i-cant-bake/
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to