In UrlHelper.php of symfony core lib there is a list of optional
parameters supported by link_to():

 * <b>Options:</b>
 * - 'absolute' - if set to true, the helper outputs an absolute URL
 * - 'query_string' - to append a query string (starting by ?) to the
routed url
 * - 'anchor' - to append an anchor (starting by #) to the routed url
 * - 'confirm' - displays a javascript confirmation alert when the
link is clicked
 * - 'popup' - if set to true, the link opens a new browser window
 * - 'post' - if set to true, the link submits a POST request instead
of GET (caution: do not use inside a form)
 * - 'method' - if set to post, delete, or put, the link submits a
request with the given HTTP method instead of GET (caution: do not use
inside a form)

So query_string should be the parameter that will fit your needs. But
as the comments are quite incomplete I do not know if this is working
with url_for()... You should be able to write your own my_url_for()
function though by adapting the solution of link_to().


On 12 Feb., 11:49, HAUSa <jeroen_heeft_behoefte_aan_r...@hotmail.com>
wrote:
> I'm using the url_for helper to generate a link in my template. The
> link has to go to an object detail page (sfPropelRoute) and has send
> some GET parameters as well.
>
> This is my route:
> article_route:
>   url:     /:sf_culture/article/:id/:slug/*
>   class:   sfPropelRoute
>   options: { model: Article, type: object }
>   param:   { module: article, action: show }
>   requirements:
>     sf_method:  [get, post]
>     sf_culture: (?:en|nl|de|fr)
>
> The correct use for an object detail page is url_for('article_route',
> $oArticle) in which $oArticle ofcourse is the correct article object.
> But not I have to create some additional GET parameter which, as far
> as I can see, is not possible with this helper. I tried
> url_for('article_route?param=test', $oArticle), but then I receive an
> exception.
> I also checked the API to see if I could use a third parameter, but
> that also is not possible.
>
> I know I could use url_for('@article_route?id=' . $oArticle->getId() .
> '&slug=' . $oArticle->getSlug() . '&param=test'), but that would give
> me quite some work if I wanted to change the route (an extra object
> parameter in the url for example).
>
> Has someone found a workaround?

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to