| routing problem with links like: /login [message #55446] |
Thu, 03 July 2008 23:30  |
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  |
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
|
|
|