On Tue, Apr 1, 2008 at 8:03 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> > 1/ Having a generic home page, leading to different pages and models
> > (users profile, content admin)
Using many models in the controller that renders the action that is
routed as default should do the trick.
> > 2/ Having a stats module which displays (on one or several pages)
> > statistics on data stored on several and unrelated model
>
> You have a few options when it comes to getting scattered data on the
> same page.
>
> There is requestAction(). It can help you run and render snippets from
> other controllers.
> There is renderElement(). Elements are "only" views and you need to
> load any data to be used in the current controller.
>
> Both can be used to render an overview-page with stats or other data
> from different parts of your application. You get data from many
> models by either "using" al of them:
> var $uses = array('Users','Pages');
> or by importing them in a specific method if you only need it
> available in a single method:
> App::import('Model', 'Users');
>
AD7six Mini controllers seems perfect for this.
http://www.ad7six.com/MiBlog/Blogs/view/MiniControllers
@AD7six: Maybe is time to update that article and put it on Bakery (or
even in the book), the article is really woth. I think the concept
still applies and I've find this very useful. Thanks you!
>
> > My idea, based on a non-MVC driven experience, will have to build a
> > generic controler that will forward requests to different methods,
> > depending on the parameters passed to the URI, ie something like
> > "page.php?page=statistics&action=view&item=users" but applied to
> > CakePHP.
>
> This is one thing CakePHP does for you, and does it very well. Read up
> on Routes and how to set up special routing if the default is not what
> you need. The default is to have the first part of the url represent
> the controller, the second the action and any others representing
> parameters passed to the action. But you can switch this around and
> parse urls in all sorts of ways.
> http://bakery.cakephp.org/articles/view/custom-urls-from-the-site-root
>
> If you are doing a CMS or something with a main controller displaying
> "pages", then you can set this up using routes. You may also want to
> search out some info on slug-urls which makes gogle happy and may also
> be more readable to visitors.
> http://bakery.cakephp.org/articles/view/slug-behavior
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---