Thank you pghoratiu, that furthers me, but I still wonder about that
and cannot get it to work:

routing.yml:

search_query:
  url: /search/q
  param: { module: search, action: search }


public function executeSearch(sfWebRequest $request) {
  var_dump($this->getRoute()->getPattern());
  $ref = $request->getReferer();
  var_dump($ref);
  $is_recursive = $this->getRoute()->matchesUrl($ref);
  var_dump($is_recursive );
  die();
}

Output:
string '/search/q' (length=9)
string 'http://localhost:8047/frontend_dev.php/search/q' (length=47)
boolean false

But I would expect the $is_recursive to be true?!
How can I evaluate if the current route is the same as the referrer
comes from? :-/

On 3 Jun., 00:28, pghoratiu <[email protected]> wrote:
> You need to evaluate your routes into a module/action tuple, see the
> last
> example on this 
> page:http://pookey.co.uk/wordpress/archives/80-playing-with-symfony-routin...
> You can probably load the routes separately from the YAML as well.
>
>      gabriel
>
> On Jun 3, 12:24 am, comb <[email protected]> wrote:
>
> > yeah but how can I check if the current page is the same as the user
> > comes from?
>
> > On 2 Jun., 21:20, Eno <[email protected]> wrote:
>
> > > On Wed, 2 Jun 2010, comb wrote:
> > > > In a executeIndex(...) I want to redirect to the referrer, but only if
> > > > the referrer is not the current action.
> > > > How can I do that?
>
> > > > //...
> > > >            $ref = $request->getReferer();
> > > >            if ($ref != ...what do I need HERE?...)
> > > >            {
> > > >                    $this->redirect(empty($ref)?'@homepage':$ref);
> > > >            }
> > > >    }
> > > > //...
>
> > > > problem is that the getReferer() method returns not a route but a
> > > > string with the whole http-uri incl. server etc..
>
> > > That's right - that's what a referrer string 
> > > is.http://en.wikipedia.org/wiki/HTTP_referrer
>
> > > --
>
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to