Hey!

First of all, you never route something to a Model...

Take a look at this portion of the CakePHP Book:
http://book.cakephp.org/view/13/Basic-Principles-of-CakePHP

In fact, you should read all the CakePHP Book in order to understand things
better. For instance, you should need to write any queries in order to get
the data you want. Try to read something related to MVC as well, and you
understand CakePHP better:
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

Hope it helps somehow!

On Wed, Oct 14, 2009 at 4:06 PM, [email protected] <
[email protected]> wrote:

>
> Ok... thanks for the tutorial. It helped some. This is my main problem
> right now... that in order to use model and controllers they need to
> be attached to a database table. And I don't always want to have a
> database table that corresponds to that model.
>
> For instance:
>
> I have 3 tables:
>
> artists
> albums
> tracks
>
> I my home page I want to pull...
>
> Latest artists added
> Latest albums added
> And just a featured artist
>
> My question is, where would I write the queries? On a element? on a
> helper? Because if I create a model (and route it to be the index)
> than that model would need a corresponding database table, which I
> wouldn't have. Can someone give me an example?
>
> Thanks!
>
> On Oct 14, 12:14 pm, red <[email protected]> wrote:
> > As I understand, you try to build some kind of dashboard. Check this
> > tutorial, maybe this works for you:
> http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-...
> >
> > On Oct 14, 5:54 pm, "[email protected]" <[email protected]>
> > wrote:
> >
> > > I kinda understand what you're saying, but I am rather lost with some
> > > concepts in Cake. I have to read more first... Thanks...
> >
> > > PS: legal seu site!
> >
> > > On Oct 14, 11:20 am, Eber Freitas Dias <[email protected]> wrote:
> >
> > > > 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.comwww.dejamps.net
> >
>


-- 
É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
-~----------~----~----~----~------~----~------~--~---

Reply via email to