Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.

Post Page Advertisement [Top]

If you want like this

example.com/article/show-by-day.html
example.com/article/slug-post.html

Shows above url in route file like this

Router::connect('/article/show_by_day',array('controller' => 'posts', 'action' => 'show'), array('pass' => array('show_by_day')));

Router::connect('/article/slug-post',array('controller' => 'posts', 'action' => 'view'), array('pass' => array('slug')));

Router::connect('/article/slug-post/:slug', array('controller' => 'posts', 'action' => 'view'), array('pass' => array('slug')));


if route like
Router::connect('/account', array('controller' => 'clientcontacts', 'action' => 'index', 'account' => true));

then its controller function is

public function account_index() {

}
 its view file is account_index.ctp

 if you want to call index function in user controller using name
 eg: admin/users/index i.e admin_index function 

No comments:

Post a Comment

Bottom Ad [Post Page]