Child routes and defaults parameters

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Child routes and defaults parameters

Oscar Fanelli
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167

Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Enrico Zimuel-2
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com
Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Alejandro Celaya
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué
Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Oscar Fanelli
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué

Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Enrico Zimuel-2
In reply to this post by Alejandro Celaya
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



On Wed, Jun 18, 2014 at 9:46 AM, Alejandro Celaya <[hidden email]> wrote:
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:

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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué



--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com
Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Oscar Fanelli
In reply to this post by Oscar Fanelli
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué


Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Alejandro Celaya

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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué


Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Enrico Zimuel-2
In reply to this post by Oscar Fanelli
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



On Wed, Jun 18, 2014 at 10:32 AM, Oscar Fanelli <[hidden email]> wrote:
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com
Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Oscar Fanelli
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



On Wed, Jun 18, 2014 at 10:32 AM, Oscar Fanelli <[hidden email]> wrote:
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com

Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Enrico Zimuel-2
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



On Thu, Jun 19, 2014 at 11:26 AM, Oscar Fanelli <[hidden email]> wrote:
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



On Wed, Jun 18, 2014 at 10:32 AM, Oscar Fanelli <[hidden email]> wrote:
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com
Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Oscar Fanelli
:) 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



On Thu, Jun 19, 2014 at 11:26 AM, Oscar Fanelli <[hidden email]> wrote:
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



On Wed, Jun 18, 2014 at 10:32 AM, Oscar Fanelli <[hidden email]> wrote:
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.
I posted some time ago a similar problem in the ZF2 repository issues list. https://github.com/zendframework/zf2/issues/5224

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.


2014-06-18 9:35 GMT+02:00 Enrico Zimuel <[hidden email]>:
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/cac1059ad29f9139a22a


Regards,
Enrico Zimuel


On Wed, Jun 18, 2014 at 12:18 AM, Oscar Fanelli <[hidden email]> wrote:
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
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com



--
Alejandro Celaya Alastrué




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com




--
Enrico Zimuel
Senior PHP Engineer     | [hidden email]
Apigility Team          | http://apigility.org
Zend Framework Team     | http://framework.zend.com
Zend Technologies Ltd.
http://www.zend.com

Reply | Threaded
Open this post in threaded view
|

Re: Child routes and defaults parameters

Ben Scholzen 'DASPRiD'
In reply to this post by Oscar Fanelli
CONTENTS DELETED
The author has deleted this message.