Sections
Notes
controller extends AppController (/app/app_controller.php) ClassName: BlaTestsController (plurals) FileName: /app/controllers/bla_tests_controller.php NeededFunctions: function index() = index.php of the http://.../bla_test/ function _foo() <-- private, not accessible by web component (controller utils) ClassName: FooComponent Filename: /app/controllers/foo.php callback: beforeFilter/beforeRender/afterFilter layout view ClassName: FooView FileName: /app/views/controllername/underscored_function_name.ctp Example: ApplesController::getCost => /app/views/apples/get_cost.ctp helper extend AppHelper (/app/app_helper.php) (view utils) ClassName: FooHelper Filename: /app/views/foo.php elements (snippets, code to reuse) model extend AppModel (/app/app_model.php) (datasource) ClassName: Foo (table (plurals) foos with primary key = id) Filename: /app/models/foo_bar.php behaviors ClassName: FooBehavior Filename: /app/models/foo.php callback: beforeFind/afterFind/beforeValidate/beforeSave/afterSave/beforeDelete/afterDelete MySQL: link = posts_tags (id, post_id, tag_id) routes default: /controller/action/var1/var2 => Controller::action($var1, $var2) 1 controller = 1 or * models folder /app /config /controllers /locale /models /plugins /tmp /vendors (Class/lib with App::import('vendor','name') /views /webroot (for css, js, img, aka theme) /cake /vendors Entité livre: Table MySQL: livres Model Class: Livre (/app/models/livre.php) Controller Class: LivresController /app/controllers/livres_controller.php View template for LivresController::index(): /app/views/livres/index.ctp URL: http://website.com/livres/ Installation: 1. get svn svn checkout https://svn.cakephp.org/repo/trunk/cake/1.2.x.x/ cake12 2. changer les permissions chmod -R g+w cake12/app/tmp && chgrp -R www-data cake12/app/tmp