开发者

What is the easiest and least boring way to learn CakePHP?

I am trying to actually learn CakePHP and be able to make a simple website with it, but the shere size of the documentation and people telling me I should have read a开发者_JS百科t least 100 pages, has kept me away from CakePHP after having worked with it for a month.

I just get a little bored when I have to read a full manual page with references, half of the used terms I have not yet known before, so it's not very effective.

I have successfully completed the blog-tutorial and read about the MVC model, I am however not ready to make a simple website. Half the time of my first attempt I ended up copy-pasting and using trial and error.


I'd suggest you follow the ACL tutorial, it's advanced but it takes you through all the sections if you've already done the blog tutorial.

You don't need to read the whole manual before starting to code. Why not just dig in and whenever you hit a snag, go read the manual and actually understand what you're doing. If you understand what you're doing and not simply copy paste, you'll run into stumbling blocks and learn more effectively.

As a start, you could try improving the system that the blog tutorial created by adding new features and learning in the process.


If you are really serious about learning CakePHP and have not seen MVC before, you should definitely read the manual entirely.

It looks huge, but it might only take you about a few hours to go through. If you dont understand something, make a note of it and research it later... or right away.

I read the entire manual in about a week, about 45 minutes per session.

To make it easy, you should order a hardcopy of the manual somewhere online (donwload and print).

Obviously, I dont remember everything I read, but it opened my eyes and whenever I come across a problem, I default back to the manual.

You can also search online for errors you are getting or curious about best approaches.

If you are not willing to sit and read the manual, most likely no one will be willing to place everything in a platter and hand it to you....


I think that diving in and building an actual website is the best way to learn. Choose something that really interests you and this will give you the motivation to search through the manual when you want to learn how to do something.

I would learn how to bake an application using the "bake" command in the console:

  • Code Generation with Bake
  • Start Cakephp – How to use shell/console/bake

Cake will generate all the code for your site - and it's a great starting point for developing a site further.

Studying other people's code can also be helpful. Two places to look:

  • The Bakery, Everything CakePHP
  • http://thechaw.com/projects


Here are the basic components you may want to start with:

  • Understanding the file structure
  • Config -> Routes ->database setting ->others
  • Controller ->view, index, add, edit, delete
  • Model ->validate->belongsTo->hasMany,hasAndbelongsToMany..
  • View ->add.ctp, view.ctp.edit.ctp...
  • Webroot -> js ->css->images->fonts->others

Step 1: Set up and configure your cake on WAMPP or XAMPP or you fav server
Step 2: create a simple hello world by adding a new page, helloworld.ctp in view folder make sure, add it in routes Router::connect('/', array('controller' => 'pages', 'action' => 'helloworld')); to test it, you can go (localhost/yourcakefolder/helloworld) to modify UA and js, go to webroot/css or js

that is a good start, then you keep going


CakeFest is in September :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜