|
|
Hi all, I have this route inside my router: https://gist.github.com/Gamempire/b3e330768f306bccbca4
But when i try to call the “album/single” route, specifying only the “title" and the “id”, it throws me an error: 'Missing parameter "page”'
Do you have any ideas why? The parameter page should be optional, because it’s inside [ ]
Thanks, Oscar
---
Oscar Fanelli Tom's Hardware Italia - Sviluppatore
Email secondaria: [hidden email]Skype: gamempire Tel: 3388696167
|
|
Hi Oscar,
if you want to support routes like: /album/123 (page=123) /album/foo-456 (title=foo, id=456) I suggest to use two different routes, one for /album[/:page] and another for /album/:title{-}-:id. They are not child routes.
If you manage the /:title{-}-:id as child route you basically need to have a /album/:page before. Moreover, I suggest to double check the definition of your route, it seems to me that shoould be '/album[/:page]' instead of '/album/[:page/]', see here:
https://gist.github.com/ezimuel/cac1059ad29f9139a22aRegards, Enrico Zimuel
|
|
Hi.
I see your point Enrico, but that may be a tough solution in some cases and I understand what Oscar is trying to make.
In this case I want an optional lang parameter to be able to be appended to any exisitng route. If I make what you suggest I will need to duplicate all the routes in my application and that could be difficult to maintain.
Is there any possible trick or workaround to make this possible?
Thanks.
|
|
Thanks Enrico and Alejandro. In fact I was just going to ask you after how many routes the router could be slow its efficiency. Now I have about 20 routes, but with this could become 30/40.
Besides, I could just use ?page=… but this is more a SEO problem. What do you recommend?
Thanks
Il giorno 18/giu/2014, alle ore 09:46, Alejandro Celaya < [hidden email]> ha scritto: Hi.
I see your point Enrico, but that may be a tough solution in some cases and I understand what Oscar is trying to make.
In this case I want an optional lang parameter to be able to be appended to any exisitng route. If I make what you suggest I will need to duplicate all the routes in my application and that could be difficult to maintain.
Is there any possible trick or workaround to make this possible?
Thanks.
|
|
Hi Alejandro,
ok, I see your point but I think this is different from the Oscar issue. You need to be sure that the first route is matched in order to manage the child_route and you need to have a default value for the lang.
and the usage of the last / in [:lang/].
Let me know if this works for you.
Enrico
|
|
Has anyone read my previous email?
Thanks
Il giorno 18/giu/2014, alle ore 10:32, Oscar Fanelli < [hidden email]> ha scritto: Thanks Enrico and Alejandro. In fact I was just going to ask you after how many routes the router could be slow its efficiency. Now I have about 20 routes, but with this could become 30/40.
Besides, I could just use ?page=… but this is more a SEO problem. What do you recommend?
Thanks
Il giorno 18/giu/2014, alle ore 09:46, Alejandro Celaya < [hidden email]> ha scritto: Hi.
I see your point Enrico, but that may be a tough solution in some cases and I understand what Oscar is trying to make.
In this case I want an optional lang parameter to be able to be appended to any exisitng route. If I make what you suggest I will need to duplicate all the routes in my application and that could be difficult to maintain.
Is there any possible trick or workaround to make this possible?
Thanks.
|
|
Yes, sorry Oscar, I didn't mean to "steal" you question.
I don't know how many routes could show down the efficiency of the router. Let's see if any one else has the answer.
--
Alejandro Celaya Alastrué
www.alejandrocelaya.com
El 19/06/2014 10:11, "Oscar Fanelli" < [hidden email]> escribió:
Has anyone read my previous email?
Thanks
Il giorno 18/giu/2014, alle ore 10:32, Oscar Fanelli < [hidden email]> ha scritto:
Thanks Enrico and Alejandro. In fact I was just going to ask you after how many routes the router could be slow its efficiency. Now I have about 20 routes, but with this could become 30/40.
Besides, I could just use ?page=… but this is more a SEO problem. What do you recommend?
Thanks
Il giorno 18/giu/2014, alle ore 09:46, Alejandro Celaya < [hidden email]> ha scritto:
Hi.
I see your point Enrico, but that may be a tough solution in some cases and I understand what Oscar is trying to make.
In this case I want an optional lang parameter to be able to be appended to any exisitng route. If I make what you suggest I will need to duplicate all the routes in my application and that could be difficult to maintain.
Is there any possible trick or workaround to make this possible?
Thanks.
|
|
Hi Oscar,
regarding the performance, you can have as many route as you want, there's not a real bottleneck, even because the route file is static and it's easily cached by the opcode (for instance, using OPcache of PHP 5.5, or APC).
That said, there's not a maximum number of routes. I have seen big ZF2 application with about 100 ruotes.
I don't recommend to use the ?page= approach. We offered a very nice URL parameters management in ZF2, it would be a shame don't use it :)
Anyway, as you said this more a SEO question, rather than ZF2.
Regards, Enrico Zimuel
|
|
Did I miss something about url parameters and pagination in ZF2?
Il giorno 19/giu/2014, alle ore 11:16, Enrico Zimuel < [hidden email]> ha scritto: Hi Oscar,
regarding the performance, you can have as many route as you want, there's not a real bottleneck, even because the route file is static and it's easily cached by the opcode (for instance, using OPcache of PHP 5.5, or APC).
That said, there's not a maximum number of routes. I have seen big ZF2 application with about 100 ruotes.
I don't recommend to use the ?page= approach. We offered a very nice URL parameters management in ZF2, it would be a shame don't use it :)
Anyway, as you said this more a SEO question, rather than ZF2.
Regards, Enrico Zimuel
|
|
Hi Oscar,
if you mean ?page= for the pagination it's absolutely fine. I was thinking that "page" parameter was something different, sorry.
Regards,
Enrico Zimuel
|
|
:) ok, thanks a lot
Il giorno 19/giu/2014, alle ore 11:44, Enrico Zimuel < [hidden email]> ha scritto: Hi Oscar,
if you mean ?page= for the pagination it's absolutely fine. I was thinking that "page" parameter was something different, sorry.
Regards,
Enrico Zimuel
|
|
CONTENTS DELETED
The author has deleted this message.
|
|