Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework]Zend_Controller_Router_Route
Earth
post
Post #1





Grupa: Zarejestrowani
Postów: 169
Pomógł: 2
Dołączył: 6.12.2006

Ostrzeżenie: (0%)
-----


Link wygląda tak:
/szkoly-tanca/balet/13-danceacademy.html
z niego potrzebuje wyciągnąć jedynie "13" do "id".

  1. routes.viewAdvertisement.type = "Zend_Controller_Router_Route"
  2. routes.viewAdvertisement.route = "/:a/:a/:id-:a.html"
  3. routes.viewAdvertisement.defaults.controller = view
  4. routes.viewAdvertisement.defaults.action = advertisement
  5. routes.viewAdvertisement.reqs.id = "\d+"


Aplikacja nie znajduje "id", lecz zamiast tego odnajduje argument ":id-:a.html". Trzeba jakoś od dzielić "id" od reszty, ale nie wiem jak:(
Go to the top of the page
+Quote Post
seth-kk
post
Post #2





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

Ostrzeżenie: (0%)
-----


uzyj Zend_Controller_Router_Route_Regex


--------------------
Go to the top of the page
+Quote Post
Earth
post
Post #3





Grupa: Zarejestrowani
Postów: 169
Pomógł: 2
Dołączył: 6.12.2006

Ostrzeżenie: (0%)
-----


Rozwiązanie:
Kod
routes.viewAdvertisement.type = "Zend_Controller_Router_Route_Regex"
routes.viewAdvertisement.route = "([^/]+)/([^/]+)/(\d+)(.+)"
routes.viewAdvertisement.map.id = 3
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 23:35