Free To Feel

Heading to entrepreneur.


Joshua Chi
Github

Cake Tips from my App

  1. If you turn on cache in core.php, everytime when you modify your model , don't forget to clear the files under /tmp/cache/models/.

  2. Don't cache the element which has include the pagination logic. Because the sort and pagination will fail to work.

  3. If there is anonymous role in your ACL model, don't divide your ACL model like this: All -- -----Anonymous -----Member-- ---------------Admin ---------------Normal

There is a thread explained this.

The following will be fine: All -- -----Member-- ---------------Admin ---------------Normal

If you want 'post/view' page can be visited by anonymous user, just add it into $this->Auth->allowedActions = array(//....);

  1. If you want to use Auth component, you should decide you will use it entirely in your application or use it a little. For example, If you want to implement your ACL like cake demo. You should remember, there is no need to write users/login action code. Cake will help you do the left including login and redirect, if you has set the auth property.
    $this->Auth->allowedActions = array(//...);
    $this->Auth->loginAction = array('controller' => 'controller_a', 'action' => 'action_a');
    $this->Auth->loginRedirect = array('controller' => 'controller_b', 'action' => 'action_b');
    $this->Auth->loginError = 'Username and password do not match. Please try again.';
    $this->Auth->fields = array(
     //...
    );
    $this->Auth->allowedControllers = array(//...);

And I think Miles post will help you a lot.

  1. If you want to send email through Gmail, take a look at this thread. And Marc has wrote an article to implement this in another way.

  2. It is easy to customize all the error pages, copying the files you needed under cake\libs\view\errors into app\views\errors. And then you can customize it to what you want.

  3. Optimize your site performance I don't want to write a lot about this. Because you can find there are a lot of resources[1] about this.

*resource[1]: 1. 8 Ways to Speed Up the Performance of CakePHP Apps 2. How To Save Half A Second On Every CakePHP Request 3. Learn more about cakephp with .htaccess and another one about .htaccess 4. CSS Compress

comments powered by Disqus