On Tue, Jan 25, 2011 at 9:23 AM, r4zv4n <[email protected]> wrote: > Hello, > > I'm on CakePHP 1.3 stable and have a routing problem for which I > haven't been able to figure a solution out (read through the docs, > googled for it, searched the group). > > What I'm trying to achieve is have all pages referred to as site.com/ > page-slug - except for some cases (such as product categories, > products, etc.). The problem is that reverse routing uses the site.com/ > pages/view/page-slug instead. > > The current rules I have are: > > Router::connect('/lolot', array('controller' => 'pages', 'action' => > 'index', 'admin' => true)); > Router::connect('/pages/menu_threaded', array('controller' => > 'pages', 'action' => 'menu_threaded')); > Router::connect('/products/display_by_category', array('controller' > => 'products', 'action' => 'display_by_category')); > Router::connect('/products/display_by_brand', array('controller' => > 'products', 'action' => 'display_by_brand')); > Router::connect('/produse', array('controller' => 'categories', > 'action' => 'index')); > Router::connect('/produse/*', array('controller' => 'categories', > 'action' => 'view')); > Router::connect('/produs/:brand--:product', array('controller' => > 'products', 'action' => 'view'), array('pass' => array('brand', > 'product'), 'brand' => '[a-zA-Z0-9\-\.]+', 'product' => '[a-zA-Z0-9\- > \.]+')); > Router::connect('/marci', array('controller' => 'brands', 'action' > => 'index')); > Router::connect('/marci/*', array('controller' => 'brands', 'action' > => 'view')); > //Router::connect('/(?!lolot|users|pages|products|produse|produse| > marci)(.*)', array('controller' => 'pages', 'action' => 'view')); > //Router::connect('/*', array('controller' => 'pages', 'action' => > 'view')); > Router::connect('/:page', array('controller' => 'pages', 'action' => > 'view'), array('pass' => array('page'), 'page' => '[a-zA-Z0-9\-\.] > +')); > Router::connect('/', array('controller' => 'pages', 'action' => > 'home')); > > (also notice my commented other attepmts that don't work) > > This works, in the way that I can access a page through site.com/page- > slug as well as site.com/pages/view/page-slug - but when I insert a > link using $html->link() and specify the controller & action, the > result is site.com/pages/view/page-slug instead of site.com/page-slug > > What am I doing wrong? What should I actually do?
It might be a good start to make that a bit more legible. And there's not much else to say without seeing an example of how you're using $html->link(). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
