On 9/15/06, Chris Lamb <[EMAIL PROTECTED]> wrote:


On Fri, 15 Sep 2006 00:04:59 -0700, John Zimmerman wrote:

> I have modified the default pages controller to add a few tweaks by
> first copying it to my app directory.  I then renamed it to
> static_controller.php, modifying the code and the views directory
> appropriately.

Did you consider extending PageController instead? Being able to still
call $this->display() is quite useful from a maintainability aspect
imho, as this function is quite well known to most Cake'ers.

For my projects I found it much more maintainable to separate the two controllers.  I wanted to  use the 'Pages" name for a content management system, so it made sense for me to just create the static_controller for static pages.
 

> The way the default pages controller (which is now my 'static'
> controller) is setup it is not meant to have multiple actions defined.

What's wrong with multiple actions OOI? They will always return 404 if
you do not have a view for them.

With multiple actions inside of the default pages controller requires you to write a route entry for each action beyond the display action (as far as I can tell).  Otherwise the pages/* route will try to send your parameters to the display action.

I found it much cleaner to separate the two controllers rather than have 1 controller that required another route modification.

Also having that route modification (i.e. pages/dynamic ) or whatever your new action would be called would cause a static page called ' dynamic.thtml' to no be displayed.  That is fairly minor, but is a collision none the less.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to