To perform some initial setup before sending visitors to a "home" pae
you have a few options. I do not really get exactly which of these is
what you are looking for.

1.1 You want to run this ONCE (when the index "page" is accessed):
You can route to a specific action as Jonknee suggests and let that
action redirect when it is done setting up.
Note that if I enter directly to any other url on your app I will not
cause the setup to run.

1.2 You want to run this ONCE for each visitor.
You create an AppController and do your setup in beforeFilter(). This
will run with most of Cake up and  available. You can access models
and do all sorts of things. Logging in is usually handled here for
example. As with logins you will want to set some data in the current
session and check for it so you can avoid running the setup over and
over on each request.

2.1 You want to run this on each request:
You can enter a lot of configuration in config/bootstrap.php. This
will run before anything else (almost). Before controllers and models
are loaded.

2.2 You want to run this on each request:
You create an AppController and do your setup in beforeFilter(). for
this scenario you do not need to set and check for a session variable.


Hope this was useful
/Martin


On Apr 3, 1:52 am, Antonio Labriola <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>    This might sound a bit stupid, but im new to cake, and I could not
> find an answer to this question in any of the documents.  I have cake
> in my root directory of my app, i have configured the db info and cake
> told me everything was all set.  It told me to edit that main view, i
> could edit some view/layout files.  However, is there a way to either
> create or modify an existing controller to perform some action when
> the user enters my site.  So once they enterwww.mysite.com/, i would
> want that default controller to initialize some data and then send the
> user to a home page.  I know cake loads the index.php file which
> defines a bunch of constants and sets up the app, but what is the best
> solution for me here?  Im sorry if i am not explaining it well, but
> any help will be appreciated.
>
> Thanks
>
>   Tony
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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