Question

Je voudrais générer une URL comme celui-ci:

/MyCategory/MySubCategory/page2.html

Je l'ai essayé de le faire de cette façon:

my_route: 
url: /:variable1/:variable2/literal:variable3.html 

sorties Symfony ceci:

/MyCategory/MySubCategory/page:variable3.html

J'utilise Symfony 1.4.1

Comment pourrais-je résoudre ce problème?

Était-ce utile?

La solution

Essayez:

my_route: 
  url: /:variable1/:variable2/:variable3
  param: { module: mymodule, action: myaction }

SF_APP / config / factories.yml:

prod:
  routing:
    param:
      suffix: .html

Utilisation:

<?php echo url_for('my_route', array('variable1'=>'news', 'variable2'=>'sports', 'variable3'=>'page2'));?>

Il devrait produire:

/news/sports/page2.html
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top