[CakePHP]: Introduction for beginners use cakephp

CAKE PHP

Posted on 2015-11-12 11:54:06


CakePHP is a for PHP . Its purpose is to provide a framework for developing user php web applications fast, powerful, flexible graphics And it is important that CakePHP is an OpenSource (free). To use it, ask the employer to know the knowledge such as PHP and HTML Fundamentals, MVC architecture, object-oriented programming.

Some features of CakePHP:
• Open Source, free, community use and widely supported PHP4 and PHP5 compatibility • • Model MVC • Multilingual • Born code automatically • Caching • Decentralisation (ACL) • Check the data binding Materials • Develop multiple library support View as: Ajax, HTML Form, Javascript ... • Develop multiple library support Controller: Email, Security, Session, Cookies, Request Handling • Easy to write additional support library , link with other applications (through vendors) • Multi interface • Supports multiple database management systems
Install
In article user settings CakePHP, Here I used CakePHP ver1.36 XAMPP webserver Mysql and Apache integration.System Requirements :
  • Window or Linux Operating Systems
  • MySQL database management system
Preparing to install: Download the latest version of CakePHP (1.3.6 stable) from:
http://github.com/cakephp/cakephp/archives/1.3 - Extract, for the directory of the web server - in this example angle webser my folder is: C: // xampp / htdocs - So we have structured as follows: C: // xampp / htdocs / cakephp
cakephp_01
cakephp_02
Installing CakePHP success: - Chmod directory app / tmp into 0777 (if on the host, but it was not necessary localhost) - Open a pp / config / core.php - Change the value of the line Configure :: write (' Security.salt ',' DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi2010 '); - Change the value of the line Configure :: write ('Security.cipherSeed', '768593096574535424967496836452011'); - Creating the database with name: cake_test - Open app / config / database.php , filled as follows:
You need to change the entry in bold to suit the configuration on your machine.
The directory structure CakePHP
After downloading and unpacking CakePHP, you can see the files and directories: - app : is where the source code of your application (section Sticky) - cake : the places where the sources of CakePHP. You should not edit the files in this folder if you do not understand them - vendors : contains 3rd party applications, catering for your application - plugins : contains the components for application expansion
cakephp_03
Note: Config file contains system configuration Controllers Contains the controllers and component Locale Contains language files, serving multi-language applications Molels Contains Model and behavor file, datasource PluginsContains the expansion pack Tmp temporary directory of applications useVendors Contains 3rd party applications Views Containing interface fileWebroot Contains document (images, files ..), CSS file, javascript file ...
Architecture CakePHP
CakePHP models operating under MVC model application divided into 3 main parts: • Model • View • Controller In this article help the reader understand the overall operation of MCV CakePHP model, in the following sections go into more detail on how to use CakePHP.
cakephp_04
Examples of basic MVC pattern: We link http://abc.com/product/view/10 - User A click on one link of the form http://abc.com/products/view/10 it :
  • The browser will send the request to the server
  • Department dispatcher Dispatcher (part of CakePHP) test elementproducts / view / 10 and send the request to the relevant controller
- Parameter # 1: I have controller product - Parameter # 2: I can view the action is the name of one of Controller productwill be called to perform certain actions 1 - 3rd parameter: it is one worth 10 , 3rd normal parameters have more or not, depending on the intended use, here I have parameter = 10 to see the product id = 10 Describe in words through the example above:
In http://abc.com/để address whether the product is id = 10
Why use MVC?
  • Because it helps us to build applications quickly
  • Ease of maintenance, modularisation
  • MVC separation of application tasks into individual components, makes it easy to add new (or change) the features that do not affect other components.