Cakephp Useful Tips

I was stumbling along today and found this great blog post on “Things You Must Know About CakePHP

There is a lot of great information in here, I especially liked the part on creating simple Admin Sections

Creating a simple admin center

If you need to create an administrative back-end for your CakePHP site and would like all the actions with administrative capabilities to exist under a specific folder, open up config/core.php and uncomment:
define(‘CAKE_ADMIN’, ‘admin’);
This will then make all actions that are prefixed with “admin_” to be accessible via:
/admin/yourcontroller/youraction. For instance, if I created an action in my posts controller called “admin_add,” I would access this via: www.example.com/admin/posts/add
From there I could simply password the admin folder to prohibit unwanted users from adding posts.

This is something that I am going to have to use in the current project that I am working on.

And knowing how to make custom 404 pages is really nice to know

Creating a custom 404 error page

If you need to change the page that users see when a document is not found, create:
/app/views/errors/error404.thtml

About Jeff

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Speak Your Mind