RE: Variables in routes
> From: cake-php@googlegroups.com > So: if You're able apply to string some regexp matches, You can access > above mentioned variables in Your routes.php file and change > everything > You want - in Your case You have to change content of variable > $from_url from '/conf-1/presentations/view/1' to > '/presentations/view/conf-1/1' in Your app/config/routes.php > file. Then > You don't have to specify any route for Your controller, as then will > be dispatched correct automatically. Brilliant, thanks! I've confirmed that all I need to do is manipulate the variable $from_url in routes.php, and everything gets wired correctly. I think I will also need to use relative URLs in my views, but I think I can sort that out. Thanks again! -- Ryan Ginstrom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Variables in routes
Hi Ryan! Just take a look into Dispatcher::parseParams() implementation. In Your app/config/routes.php You can access instance of Router as $route, url as $from_url and (by dispatcher) not-touched superglobals $_GET and $_POST. So: if You're able apply to string some regexp matches, You can access above mentioned variables in Your routes.php file and change everything You want - in Your case You have to change content of variable $from_url from '/conf-1/presentations/view/1' to '/presentations/view/conf-1/1' in Your app/config/routes.php file. Then You don't have to specify any route for Your controller, as then will be dispatched correct automatically. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Variables in routes
First I would like to say that I am really enjoying using cake. It makes site development much easier and more fun. I am using cake 1.0.xx, PHP 4.4.3-dev (PHP 5 available, by default used for .php5 extension) I am trying to figure out how to handle my url structure. I am developing a site for an annual conference. Since most of the pages for each conference will be the same, I want to do something like: /conf-1/presentations/ /conf-1/presentations/view/1 /conf-2/presentations/ ... and so on, where "conf-?" is a variable that I pass to the appropriate controller, so it knows which conference to retrieve the information for. What I would really like is to match /conf-(\d)+/, and use that as the first param. So for instance, /conf-1/presentations/view/1 would call PresentationsController::view( $conf, $id ) with $conf = 'conf-1' and $id = 1 I hope someone can tell me a way to do this, or a better way to do what I want to do. I also apologize in advance if this has been covered before. I have done a search, and found the tantalizing reference to dealing with i18n by AD7six, e.g. in routes.php: $Route->connect ('/en/:controller/:action/*', array('controller'=>'pages', 'action'=>'view', "language"=>"en")); But here the languages are hard coded. Thanks in advance for any help. -- Ryan Ginstrom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---