Hi.
I'm new to CakePHP too. I was wondering the same thing. In my job I'm
working with ASP.NET2.0 applications and there are MasterPages. This
is something similar to layouts in Cake, but it allows to do some
things not possible now in Cake:
1. There is possibility to define a MasterPage for MasterPage
(MasterPage nesting). For example I can have 2 masterpages defining
different column layouts (1 column, 2 columns, etc) and they both are
using a third masterpage with page header and footer. So the main
MasterPage encapsulates one of those 2 masterpages and then one of
them encapsulates a content page.
It would be great to have a possibility to nest layouts in Cake the
same way (for example by defining a $layout var on top the layout file
or something like that.
2. The MasterPage uses <asp:ContentPlaceholder> elements to place
contents in proper places on the page. But it allows to include more
than 1 placeholder (they are named). The content Page which uses this
MasterPage can define a content for each placeholder. So when the
master page has 2 placeholders named "maincontent" and "sidebar" I can
define in a Page separate content for each of them
(ContentPlaceholders can have a default content, so when specific Page
doesn't define a content for it, it will use the default).
I wonder if it would be possible to somehow emulate this behavior in
Cake using elements and components. For example:
- an element for defining additional contents in layout (placed in
layout files)
- a component which would allow to define in controller, from where it
can get the content for specific content element
or (instead of component)
- a special tag which could be used in view (like <cake:nocache>) for
example <cake:content name="name_of_the_content">some content</
cake:content>, which wouldn't be rendered as the main content, but
instead it would be "transfered" to an element named
"name_of_the_content" in layout.
Example:
in layout file (simplified):
<html>
<body>
<div id="leftcol"><?=$content_for_layout ?></div>
<div id="rightcol"><? $this->renderElement('namedContent',
array('name' => 'name_of_the_content')); ?></div>
</body>
</html>
in view:
<div>Normal content rendered as $content_for_layout</div>
<cake:content name="name_of_the_content">
This content should not be rendered to $content_for_layout. Instead it
should be displayed by namedContent element.
</cake:content>
It would be also possible to not using element to render this named
content (the content could be available through
$contents_for_layout["name_of_the_content"] associative array in the
layout, and the main content could be available like now, or using
some default key in the array). I think that this would require
modification of the core of Cake.
I don't know if this is even possible. As I said I'm new to Cake and
I'm now discovering all the goodies in it. Maybe there are some other
ways to do this.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---