-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

BenG wrote on 11.12.2009 12:11:
> Hi,
> 
> Our application requires a number of routes to be defined which are
> dependent on dynamically populated database fields. This currently results
> in quite a lot of queries on each page load.
> 
> Is it possible to build up all the routes and then cache the router object
> so it doesn't need to be built on each page load?

Nope, that's not possible

> As a second part to my question, we have an e-commerce site with over 5000
> products and it would be nice to have friendly URLs for them. At the moment
> we us a friendly URL which includes the product id. We could get rid of the
> need for a product id in the URL by defining static routes for all products
> but I assume it would be a bad idea to have so many routes defined?

That's actually a really bad idea. I'd suggest to create the following
route:

new Zend_Controller_Router_Route('product/:productSlug');

This route would go to some controller, which then tries to grab a
product with that slug. If there is no product with that slug, it throws
an exception which is then cought properly by the error controller.

> Thanks in advance,
> 
> Ben

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksj+B8ACgkQ0HfT5Ws789AVVwCghypf/S3asRMwedITLqAjon3E
6mUAn0jgIGswhxXSyvAthaP4DptFf4+E
=ic08
-----END PGP SIGNATURE-----

Reply via email to