Despite I've not yet tested that, I think it may work in your case :

<?php
class cultureFilter extends sfFilter
{
 public function execute($filterChain)
 {
       ...

       if (!in_array($this->getContext()->getUser()->getCulture(), $codes))
       {
               $this->getContext()->getUser()->setCulture('en');
               // I want to produce a 404 here !
               return $this->getContext()->getController()->forward404();
       }

       $filterChain->execute();
 }
}

On Tue, Aug 26, 2008 at 10:47 PM, Vinch <[EMAIL PROTECTED]> wrote:

>
> Okay that's better but I don't want to accept all strings with two
> characters.
> In your example, http://myurl/zz/contact will work but zz is not an
> iso code for a language.
> Only limit to a list of string coming from database --> that's the big
> deal...
>
> On 26 août, 18:20, "Nicolas Perriault" <[EMAIL PROTECTED]> wrote:
> > On Tue, Aug 26, 2008 at 5:18 PM, Vinch <[EMAIL PROTECTED]>
> wrote:
> > > The problem is when I type something
> likehttp://myurl/dqsdhjdssqd/contact,
> > > it works and it gives me the contact page in english. I would rather
> > > have a 404 error (forward to my own 404 page). How is it possible?
> >
> > Maybe by adding a "requirements" ruleset in your route definition, like
> this:
> >
> > myroute:
> >   url: /:sf_culture/:blah
> >   param: { module: foo, action: bar}
> >   requirements: { sf_culture: [a-z]{2} }
> >
> > (note that I did not check the syntax, but you see the point)
> >
> > ++
> >
> > --
> > Nicolas Perriaulthttp://prendreuncafe.com-http://symfonians.net-
> http://sensiolabs.com
> > Phone: +33 660 92 08 67
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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