Home > cakePHP > Building websites with cakePHP

Building websites with cakePHP

November 13th, 2008

In the last article I described how to set up a smooth Apache, PHP & MySQL configuration using as much built in features of Mac OS X as possible and how to get cakePHP up and running.

The intention was to have a local cakePHP setup for developing a website. The website can later on be easily transfered to an external web hosting provider. The reason to do it this way is convenience! Because we’re running everything on our local machine we have full administrative rights AND the power to BAKE! Baking is one of the great tools of cakePHP that allows you to rapidly start with your website development. Building websites with cakePHP follows ideally this way:

  1. Design your database model on paper, in your head or using available software.
  2. Create the tables in the database using phpMyAdmin and following Cake convention (more on this later)
  3. Bake your Models
  4. Bake your Controllers
  5. Bake your Views - your website structure is ready at this point
  6. Add functionality, design etc.

So basically it all comes down to three points: your database design, the MVC-pattern & Baking. While I’m not a database expert myself it’s actually quite easy if you stick to one important rule: try not to have redundancy! I’ll show you later on what I mean by that when we design the database model for django.at (and the other sites that is). The MVC pattern is another important concept when developing with cakePHP (and most other frameworks as ZEND). It basically means that you try to split your application data (models), from the logic (controllers), from the layout (views). There is quite a good introduction available in The Cookbook that I would recommend to read.

And now onto Baking. You actually don’t have to use Baking to build a website with cakePHP as you can create everything manually as well. But Baking saves you tons and tons of time because what Baking does is to create your model, controller and view files automatically based on the database design documented through the tables you have created in your database.

cakePHP ,

  1. No comments yet.
  1. No trackbacks yet.