Search code examples
cakephplayoutviewdefaults

What are the defaults(homepage,controller,etc..) for cakePhp?


I understood (more or less) the separation between the MVC parts in cakePhp, however i cannot understand what are the defaults. meaning:

What should i edit in order to change the root-entry-point of my site(the known "index.html" or "index.php" file, that shouldn't be changed in cake)?

What controller? What model? What view? What layout? (hope I'm understood) (i am using version 1.3)

thanks


Solution

  • What you should edit to modify the root is:

    app\views\pages\home.ctp
    

    The default layout can be tweaked here:

    app\views\layouts\default.ctp
    

    From there on you can create your menus, links etc to other controllers of other pages, then involving the traditional MVC patterns/conventions you already know.

    Addition:

    If you want to provide a link to your statistics then use for example:

    echo $html->link('My nice statistics',
            array('controller' => 'statistics', 'action' => 'show'));
    

    If you would like to embed the statistics then I would use elements: http://book.cakephp.org/view/1081/Elements.

    I am not sure about what you missed: maybe the fact you can specify the controller to use for links if it is an external controller to the MVC scope currently used.

    Are you sure you have understood the conventions behind MVC? Here is the tutorial I started with some time ago. It is well made but a bit out of date for cakephp 1.3. Nevertheless it illustrates the basic concepts very nicely: Cook web sites fast using CakePHP (IBM)

    I hope this is more helpful then :-)