On 28 Jul 2009, at 16:55, Michal Charemza wrote:
> But this was only a minor issue of my posts: I am still keen to know
> about generating URLs that are actually relative to the root of the
> Agavi site, rather than relative to the domain...?
I'm not sure if it's a bit hackish, but I figured out a way by
extending the routing class, and overriding the gen method. It makes
sure that the route generated is relative, and that the basePath is at
the beginning. If so, it removes the basePath from the string,
returning a "really" relative URL:
public function gen($route, array $params = array(), $options = array())
{
$generatedRoute = parent::gen($route, $params, $options);
$trimBase = !isset($options['relative']) ||
(isset($options['relative']) && $options['relative'] == false);
$trimBase = $trimBase && (strpos($generatedRoute, $this->basePath)
=== 0);
$generatedRoute = ($trimBase) ? substr($generatedRoute, strlen($this-
>basePath)) : $generatedRoute;
return $generatedRoute;
}
I'm not sure if this is really bad, but it seems to work so far...
Michal.
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users