Thursday, December 11, 2008

Wildflower Robust Templates

I've been toying around with Wildflower templates, and I've come up with a basic structure.

Monday, December 08, 2008

Getting CakePHP Help


So I have a problem and I need to get help. Where do I start?

To a beginner, CakePHP can be overwhelming, especially if you are new to the Model / View / Controller (MVC) methodology. So I've come up with a few tips that may help you get started.

1) Start at the beginning. Cake is big and there are a lot of custom methods that exist. Many times learning something to the scale of cake is intimidating, and rather than jumping in to get your hands dirty, you get confused as to exactly where to start. Well, the best place to start is the beginning.

.htaccess - This is the first place apache will look. Read through the .htaccess files in cake to see how Apache reacts to your url string. In CakePHP, the .htaccess file points to app/webroot folder. The app/webroot/.htaccess file says "If the file doesn't exist, open up index.php. If the file does exist, simply display it."

There you have it. Webroot is your root directory. index.php is the file that is executed for any dynamic content. Open up index.php and you'll realize that it simply runs the dispatcher class.
  • Don't be afraid to trace through code.
  • Grep (or Windows Grep) is your friend to find what you are looking for.
  • Don't be afraid to add debug the CAKE source files.
2) Find example code. Most basic types of applications have been built and documented somewhere on the internet. For CakePHP, there are a number of screencasts on cakephp.org. Also check out the Cake Bakery on cakephp.org. Google is your friend. Search for examples, set them up and get them working.
  • Invest the time to learn. It will pay off.
  • Don't take shortcuts. Take each part and explore it until you understand it.

3) Ask for help. Sometimes you will need help. It may be a specific question about a certain set of code, or it could be a concept question. Asking questions is important, and there are many people willing to answer your question, but remember these important tips for asking questions:
  • Make your question make sense. If you can't understand it, the reader won't either.
  • Be specific. Give code samples. Give as much detail as you can.
  • We don't bite, so don't be afraid to just ask. Sometimes people's responses will help you to narrow down the specifics of your question.
  • Where can I ask you ask?

Other Resources:


Check out these CakePHP Resources: http://cakebaker.42dh.com/cakephp-resources/