Hi Jim

To me, the simplest method would be to use the built-in PagesController.
you only need to create (or change the default) /app/view/pages/home.ctp
and use the router to make it your root index (just like it actually is in a
fresh CakePHP install: see /app/config/router.php)
Then in this view (home.ctp), use renderElement and requestAction to display
your elements:
in general, I use renderElement for static or global bits of HTML (for
example, the user login form) and requestAction to display data from other
Controllers / Models (for example, the highscore display, which would
probably need a method in your "scores" controller, and a view)

+++++++
clément

On Thu, Feb 21, 2008 at 5:46 PM, jim starboard <[EMAIL PROTECTED]>
wrote:

>
>
> Sorry about getting off on the wrong foot.
>
> I think my main question is: Should I create a controller for my
> homepage? My homepage is not really specific to a single model, so it
> would not be named as such. So is it OK to have something like
> HomeController, with an index method? In general do you create
> controllers that only have an index method?
>
> All the tutorials have very tight relationships between a single
> table, controller, view and model, I wish there were more examples of
> multiple models being used, as well as controllers that were not tied
> to as single model/table.
>
>
> On Feb 20, 4:36 pm, "DJ Spark" <[EMAIL PROTECTED]> wrote:
> >    Your controller will get all the info you need from models, and
> > using $this->set('varname', $yourinfo) will make it available for the
> > view, where you make a loop (prabably) and show your information
> >   The basic blog example inhttp://manual.cakephp.orgwill show it in
> > a very easy way. just try it.
> >
> >    Spark
> >
> >
> >
> > On Wed, Feb 20, 2008 at 5:43 PM, jim starboard <[EMAIL PROTECTED]>
> wrote:
> >
> > >  I'm trying to get a high-level understanding of how you would handle
> a
> > >  site's homepage. Lets say it's a gaming site. Some of the items on
> the
> > >  homepage would be:
> >
> > >  -userlog in -- would show logged in state, if the user was logged in.
> > >  -highscores -- would show high scores in different games
> > >  - featured game -- admin tools select which game is featured.
> >
> > >  I understand the basic MVC idea, and I can create models and
> > >  controllers for each of my *single* items, like user, game, etc.
> Where
> > >  I get confused is how I combine information in a view. Is the
> homepage
> > >  a single view or multiple views combined? Do I need a controller for
> a
> > >  page like index? Basically looking for any help here, with a high
> > >  level explanation.
> >
> > >  TIA
> > >  Jim
> >
> > --
> > [livesets]http://djspark.com.br/
> > [web]http://sydi.net
> > [filmes]http://melhoresfilmes.com.br
> >
>

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

Reply via email to