Project-Id-Version: Trac 0.12
Report-Msgid-Bugs-To: trac-dev@googlegroups.com
POT-Creation-Date: 2008-01-30 09:20+0100
PO-Revision-Date: 2010-07-19 23:05+0200
Last-Translator: Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
Language-Team: en_US <trac-dev@googlegroups.com>
Plural-Forms: nplurals=2; plural=(n != 1)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Generated-By: Babel 0.9.6

Warning: Can't synchronize with repository "(default)" (Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? ). Look in the Trac log for more information.

Changes between Version 3 and Version 4 of DevHelp


Ignore:
Timestamp:
07/20/12 19:09:31 (8 years ago)
Author:
sebastian
Comment:

Update doc for CakePHP 2.1

Legend:

Unmodified
Added
Removed
Modified
  • DevHelp

    v3 v4  
    1 phTagr uses the flexible and easy to learn PHP framework [http://www.cakephp.org CakePHP] 1.2 which comes with a [http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Model-View-Control] architecture. 
     1phTagr uses the flexible and easy to learn PHP framework [http://www.cakephp.org CakePHP] 2.1 which comes with a [http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Model-View-Control] architecture. 
    22 
    33[[PageOutline]] 
    44 
    5 To understand the code of phtagr it is important to understand the basic principle of MVC and CakePHP (see [http://book.cakephp.org/view/10/Understanding-Model-View-Controller Understanding-Model-View-Controller], [http://book.cakephp.org/view/21/A-Typical-CakePHP-Request A-Typical-CakePHP-Request], and [http://book.cakephp.org/view/13/Basic-Principles-of-CakePHP Basic-Principles-of-CakePHP]). However, it is quite simple to get into the code and this page will lead you to the major and important sites and hints. 
     5To understand the code of phtagr it is important to understand the basic principle of MVC and CakePHP (see [http://book.cakephp.org/2.0/en/cakephp-overview/understanding-model-view-controller.html Understanding Model View Controller], [http://book.cakephp.org/2.0/en/getting-started/a-typical-cakephp-request.html A Typical CakePHP Request], and [http://book.cakephp.org/2.0/en/getting-started.html Getting Started]). However, it is quite simple to get into the code and this page will lead you to the major and important sites and hints. 
    66  
    77= Where to get help? = 
    88 
    99 * Mailinglist phtagr-gallery [at] lists.sourceforge.net (List info at [https://lists.sourceforge.net/lists/listinfo/phtagr-gallery  SourceForge.net]) 
    10  * http://book.cakephp.org 
    11  * http://book.cakephp.org/view/9/Where-to-Get-Help 
    12  * http://cakephp.org/files/Resources/CakePHP-1.2-Cheatsheet.pdf  
     10 * http://book.cakephp.org/2.0/en/contents.html 
     11 * http://book.cakephp.org/2.0/en/cakephp-overview/where-to-get-help.html 
    1312 * Email to xemle [at] phtagr.org 
    1413 
     
    1918The source has a special file structure and reflects to the MVC architecture. See also http://book.cakephp.org/view/20/The-App-Folder 
    2019 
    21  * cake - CakePHP framework files 
    2220 * phtagr (or app) - phtagr files 
    23   * config - config files. Mainly {{{config/core.php}}} and {{{config/database.php}}} 
    24   * models - Model files like Media, User, Group, etc 
    25    * behaviors - Helpers for Models with specific behavior like Cipher, Type, Flag, etc. 
    26   * controllers - Handles all the logic 
    27    * components - Helpers for controllers like !FileManager, !FilterManager, !QueryBuilder, etc. 
    28   * views - View files of the controllers 
    29    * helpers - Helpers for the views like !ExplorerMenu, Cloud, Option, etc. 
    30    * elements - Little parts of pages are handled in elements. 
    31   * vendors - 3rd party files like kcaptcha, phpThumb 
    32   * plugins - extensions of phtagr. Eg. DupFinder 
     21  * cakephp - CakePHP framework files 
     22  * Config - config files. Mainly {{{config/core.php}}} and {{{config/database.php}}} 
     23  * Model - Model files like Media, User, Group, etc 
     24   * Behavior - Helpers for Models with specific behavior like Cipher, Type, Flag, etc. 
     25  * Controller - Handles all the logic 
     26   * Component - Helpers for controllers like !FileManager, !FilterManager, !QueryBuilder, etc. 
     27  * Views - View files of the controllers 
     28   * Helper - Helpers for the views like !ExplorerMenu, Cloud, Option, etc. 
     29   * Element - Little parts of pages are handled in elements. 
     30  * Vendor - 3rd party files like kcaptcha, phpThumb 
     31  * Plugin - extensions of phtagr. Eg. DupFinder 
    3332 
    3433== Coding Convention == 
    3534 
    36 phTagr follows basically the [https://trac.cakephp.org/wiki/Developement/CodingStandards coding standards of cake] - except that phtagr uses to spaces instead of tabs. 
     35phTagr follows basically the [http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html coding standards of cake] - except that phtagr uses to spaces instead of tabs. 
    3736 
    3837== An example == 
    3938 
    40 The plugin DupFinder is a nice example to get into the code. Its actions is limited but straightforward. See its [http://trac.phtagr.org/browser/plugins/dupfinder/trunk code] for details. 
     39The plugin DupFinder is a nice example to get into the code. Its actions is limited but straightforward. See its [https://github.com/xemle/phtagr-dupfinder code] for details. 
    4140 
    4241= Debugging = 
     
    4443While developing on phtagr it is always a good idea to increase the debug level of cake to retrieve hints and errors of missing actions, views or even typos. To see behind phtagr actions watch on its log file! 
    4544 
    46  * Enable Debug mode in {{{config/core.php}}} and set it to level 2: 
     45 * Enable Debug mode in {{{Config/core.php}}} and set it to level 2: 
    4746 {{{ 
    4847Configure::write('debug', 2); 
     
    6968}}} 
    7069 
    71 Further the action need a view in {{{views/controller/action.ctp}}}. For controller {{{ExplorerController}}} and action {{{hint}}} it would be {{{views/explorer/hint.ctp}}}. 
     70Further the action need a view in {{{View/Controller/action.ctp}}}. For controller {{{ExplorerController}}} and action {{{hint}}} it would be {{{Views/Explorer/hint.ctp}}}. 
    7271 
    73 The parameters are passed to the action. There are also stored in {{{$this->params['passed']}}}. Special parameters with the structure {{{name:value}}} are named parameters and are stored in {{{$this->params['named']}}}. 
     72The parameters are passed to the action. There are also stored in {{{$this->request->params['passed']}}}. Special parameters with the structure {{{name:value}}} are named parameters and are stored in {{{$this->request->params['named']}}}. 
    7473 
    7574== Get data from the controller to the view? == 
    7675 
    77 There are different ways to save data for the view within the controller. The special controller variable {{{$this->data}}} is also available in the view as {{{$this->data}}}. Named variables could be set via {{{$this->set()}}} method. Or data could be stored in a special parameter array in {{{$this->params}}} - which is used in special cases. 
     76There are different ways to save data for the view within the controller. The special controller variable {{{$this->request->data}}} is also available in the view as {{{$this->request->data}}}. Named variables could be set via {{{$this->set()}}} method. Or data could be stored in a special parameter array in {{{$this->request->params}}} - which is used in special cases. 
    7877 
    7978{{{ 
    8079class ExplorerController extrends AppController { 
    8180  function storage() { 
    82     // View: $this->data 
    83     $this->data = 'Special variable'; 
     81    // View: $this->request->data 
     82    $this->request->data = 'Special variable'; 
    8483    // View: $foo 
    8584    $this->set('foo', 'Named variable for the view'); 
    8685    // View: $this->params array. 
    87     $this->params['search']['help']; 
     86    $this->request->params['search']['help']; 
    8887  } 
    8988} 
     
    9796class ExplorerController extrends AppController { 
    9897  function edit() { 
    99     if (!empty($this->data)) { 
    100       $media = $this->Media->findById($this->data['Media']['id']); 
     98    if (!empty($this->request->data)) { 
     99      $media = $this->Media->findById($this->request->data['Media']['id']); 
    101100      // further actions 
    102101    } 
     
    153152}}} 
    154153 
    155 See also: http://book.cakephp.org/view/75/Saving-Your-Data, http://book.cakephp.org/view/73/Retrieving-Your-Data 
     154See also: [http://book.cakephp.org/2.0/en/models/saving-your-data.html Saving Your Data], [http://book.cakephp.org/2.0/en/models/retrieving-your-data.html Retrieving Your Data] 
    156155 
    157156== Enhanced debugging output with debug_kit plugin == 
    158157 
    159 The [http://thechaw.com/debug_kit debug_kit] plugin adds nice debug information to cakePHP applications. 
     158The [https://github.com/cakephp/debug_kit/ debug_kit] plugin adds nice debug information to cakePHP applications. 
    160159 
    161 Versions could be found at http://thechaw.com/debug_kit/versions, eg. [https://www.ohloh.net/p/cakephp-debugkit/download?filename=debug_kit_1.1.zip debug_kit_1.1.zip] 
     160According to the {{{README}}} of debug_kit: 
    162161 
    163 According to the README of debug_kit: 
    164  
    165  * Copy the files in this directory into {{{app/plugins/debug_kit}}} 
    166  * Include the toolbar component in your {{{app_controller.php}}}: 
     162 * Copy the files in this directory into {{{Plugin/DebugKit}}} 
     163 * Enable plugin at {{{Config/bootstrap.php}}} 
     164 {{{ 
     165  CakePlugin::load('DebugKit'); 
     166}}} 
     167 * Include the toolbar component in your {{{Controller/AppController.php}}}: 
    167168 {{{ 
    168169  var $components = array('DebugKit.Toolbar'); 
    169170}}} 
    170  * Set debug mode to at least 1. (in {{{app/config/core.php}}}) 
     171 * Set debug mode to at least 1. (in {{{Config/core.php}}})