Hi!
The fact that "home.ctp" is the default home for your app it doesn't mean
you have to use it!
You can just re declare a new home in your routes using the controller you
want. Something like:
Router::connect('/', array('controller' => 'mycontroller', 'action' =>
'index'));
The second argument on the connect method works just like the url on your
link methods from the html helper.
There is some basic understanding related to behaviours, components and
helpers... See:
Helpers extends functionality to views.
Components extends functionality to controllers.
Behaviours extends functionality to models.
If you need some custom data, instead of using requestAction, I would
consider creating a new function on your model and simply calling it
instead. You can create as many functions you like in your modesl, and once
you start doing that, you won't stop. It makes things really simpler!
On Wed, Oct 14, 2009 at 11:57 AM, [email protected] <
[email protected]> wrote:
>
> Thanks. That helps a little. From what I've been reading it's better
> to use Elements for HTML chunks and Helpers for logic. But
> requestAction seems like a good option too.
>
> On Oct 14, 10:54 am, Céryl <[email protected]> wrote:
> > I don't really know the answer, but just to add to that, the home.ctp
> > has a controller, it's the pages_controller.
> > And also, you can of course use actions from other controllers and
> > models in the pages-views by using Cake's requestAction. I use it
> > sometimes to get for instance number of posts, users, pictures or
> > whatever on the sites main index page.
> >
> > On 14 okt, 16:38, "[email protected]" <[email protected]>
> > wrote:
> >
> > > On the index of my website I get content from several different tables
> > > in the database. Which is best to use? Elements? Behaviors? or
> > > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > > a model or controller.
> >
>
--
Éber Freitas Dias
www.eberfdias.com
www.dejamps.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---