This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.1 » routing problem with links like: /login
routing problem with links like: /login [message #55446] Thu, 03 July 2008 23:30 Go to next message
volod  is currently offline volod
Messages: 85
Registered: June 2008
Member
Hello,

I've upgraded my project to sf1.1 and have a problem with routing.
The routing.yml file is:
sf_guard_signin:
   url:   /login
   param: { module: sfGuardAuth, action: signin }

...


in sf 1.0 following code worked fine:
 echo link_to('Login', '/login')


but not in sf1.1. I tried
 echo link_to('Login', '@sf_guard_signin')

and it worked, but it doesn't help, 'cause I have a lot of other similar links

How to solve it?

Thanks!


Vladimir Bilyov Websites development and support, Design, SEO
Re: routing problem with links like: /login [message #55468 is a reply to message #55446 ] Fri, 04 July 2008 11:01 Go to previous message
volod  is currently offline volod
Messages: 85
Registered: June 2008
Member
here's my solution taken from 1.0 (patch):
Index: sfWebController.class.php
===================================================================
--- sfWebController.class.php	(revision 10114)
+++ sfWebController.class.php	(working copy)
@@ -29,7 +29,7 @@
    * @return string A URL to a symfony resource
    */
   public function genUrl($parameters = array(), $absolute = false)
-  {
+  {   
     // absolute URL or symfony URL?
     if (!is_array($parameters) && preg_match('#^[a-z][a-z0-9\+.\-]*\://#i', $parameters))
     {
@@ -140,14 +140,19 @@
     {
       $route_name = substr($url, 1);
     }
-    else if (false !== strpos($url, '/'))
+    else //if (false !== strpos($url, '/'))
     {
-      list($params['module'], $params['action']) = explode('/', $url);
+      //list($params['module'], $params['action']) = explode('/', $url);
+      $tmp = explode('/', $url);
+
+      $params['module'] = $tmp[0];
+      $params['action'] = isset($tmp[1]) ? $tmp[1] : sfConfig::get('sf_default_action');
+      
     }
-    else
+    /*else
     {
       throw new InvalidArgumentException(sprintf('An internal URI must contain a module and an action (module/action) ("%s" given).', $givenUrl));
-    }
+    }*/
 
     // split the query string
     if ($query_string)


Vladimir Bilyov Websites development and support, Design, SEO
Previous Topic:sfWidgetFormSelect - how automatic associate data from database
Next Topic:An internal URI must contain a module and an action
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software