Humm when I create the HomesController, it then requires me do build
the Homes Model and then that requires an actual database table...

Is there a way so I can just create a home page and display different
data from different models regardless of their relation?



Mariano Iglesias wrote:
Create a controller and an action. Let's say:

1. Create a file called app/controllers/homes_controller.php with the
following:

class HomesController extends AppController
{
        function index()
        {
                $this->set('title', 'Home Page');
        }
}

2. Create the view on file app/views/homes/index.thtml.

3. Edit app/config/routes.php and look for following line:

        $Route->connect('/', array('controller' => 'pages', 'action' =>
'display', 'home'));

   Change it to:

        $Route->connect('/', array('controller' => 'homes', 'action' =>
'display', 'index'));

After this your home page will be the index() action on your Homes
controller, so you can use your models there and stuff.

PS: I called the controller Homes instead of Home because as per CakePHP
recommendations controllers are to be plural.

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.

BAKE ON!


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Tazz
Enviado el: Lunes, 18 de Diciembre de 2006 03:10 a.m.
Para: Cake PHP
Asunto: How do i change default home page?


Please confirm if this is the right thing to do...

On my front page I want to show data from various models! Obviously,
the default home page created by the bake.php script is just a static
page...


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