Hi,
I have a controller called "Shops", this is the way the routing system looks for it, however I want to be able to called this controller and what not 'shop'.
Is it possible to do this.
Cheers!
Hi,
I have a controller called "Shops", this is the way the routing system looks for it, however I want to be able to called this controller and what not 'shop'.
Is it possible to do this.
Cheers!
yes. go to www.yoursite.com/shop
look at the error message and follow the template
OR
in route.php. redirect shop to shops
It sounds like you are just trying to just change the URL from example.com/shops to example.com/shop ... is this correct? If so edit app/config/routes.php to include the following line:
Router::connect('/shop/*', array('controller' => 'shops'));
Note: The above solution is probably what you are looking for, however if you intended to make CakePHP never pluralise 'shop' to 'shops' then the following is how you do that:
You'd edit app/config/inflections.php and modify the $uninflectedPlural array to include 'shop'.
For example:
$uninflectedPlural = array('shop');
From then on your controller will be: app/controllers/shop_controller.php with "class ShopController extends AppController"
And your model will stay as per usual with app/models/shop.php with "class Shop extends AppModel"
Hopefully the above helps you.