Constants, Paths and ecetera in CakePHP

It took me longer than it should have to find the Global Constants And Functions section of the CakePHP Manual. At least I seem to remember searching for it a few times. Maybe I was looking for something with a vague keyword. Ah, yes – how to get the path to a specific directory in an application (see WWW_ROOT versus WEBROOT_DIR). There is a lot of good information in that chapter. You can find the path to almost anywhere in a CakePHP installation with the constants near the bottom of the page. Looking through the functions list turns up a number of tricks as well.

If you’re looking for more information on paths in CakePHP, there is an article in the Bakery that has a little more info on getting the path to webroot from within views and helpers.

You might also find one of the various cakeinfo() tools helpful. Although I have yet to try them, they look super handy.

2 Comments