CakePHP CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code. In this tutorial i have explained basics of CakePHP. How [...]
news and informationbusiness,health,entertainment,technology automotive,business,crime,health,life,politics,science,technology,travel
CakePHP

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code.
In this tutorial i have explained basics of CakePHP. How to Getting Start With CakePHP.
MVC architecture
Model–view–controller (MVC) is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates “domain logic” (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each.

Model View Controller (MVC) pattern creates applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements
Basics of CakePhp
Folder Structure

Naming conventions
View–Class name :MyFirstClass | filename: my_first_name.php
Model–Classname: Book | tablename: books
Controller–Classname: BooksController
Ex:
Database table : books
Model class : Book
Controller class : BooksController
View found at : /app/views/books/index.ctp
Steps
Getting Start With CakePHP
- Creating the database
- Creating a model
- Creating a controller
- Creating the views
1. Creating the database
- Create a new table (name should be according to the naming conventions)
- Enter the data.
- (Using phpmyadmin)
2. Creating a model
- Separates the domain logic from presentation isolating the application logic.
- Extends AppModel(extends Model)
- Contains data validation rules, association information and methods specific to the table it uses.
- For complete reference http://api.cakephp.org
- Cakephpdynamically creates a model object
class Book extends AppModel{
var$name = ‘Book';
}
- We do can add some behaviors to each model.
3. Creating a controller
- Manages the logic for a part of our application
- Can access the model object by $this->Book
class BooksControllerextends AppController{
var$name = 'Books';
function index() {
$this->set('books', $this->Book->find('all'));
}
}
$this->loadModel(‘Article'); loads a different model
- Components (packages of logic that are shared between controllers)
4. Creating the views
- Layouts (placed in /app/views/layouts)
- Elements (reusable parts)
Helpers
(var$helpers = array('Form', 'Html', 'Javascript', 'Time');)
Sample model
array(
'rule' => 'notEmpty'
),
'author' => array(
'rule' => 'notEmpty'
)
);
}
?>
Sample Controller
set('books', $this->Book->find('all'));
}
function view($id = null) {
$this->Book->id = $id;
$this->set('book', $this->Book->read());
print_r($this->viewVars);
}
}
Sample view
Books
| Id |
Title |
Author |
|
link($book*‘Book+*'title'+,
array('controller' => ‘books’, 'action' => 'view', $book*‘Book+*'id'+)); ?> |
|
References : http://book.cakephp.org/view/4/Beginning-With-CakePHP
Getting Start With CakePHP.
news and informationbusiness,health,entertainment,technology automotive,business,crime,health,life,politics,science,technology,travel
2 Responses
sir plz can you tell me how to use paypal in cakephp ..
CakePHP certainly provides a flexible framework that allows developers to make databases inspired websites and web applications that are easy to develop, maintain and set up.