Skip navigation

Sign up | Lost password? | Help

Hello World

Practical programming... and stuff...

Routing and complex URLs in Zend Framework

,

We were talking about routing on the #zftalk IRC channel. One of the users mentioned that rather than using routes, he was using the __call method in the IndexController.

I then asked him why is he doing that, as I knew routes would be more than a good choice for most kinds of URLs.

I found out that he was working with SEO and he was using a very interesting URL scheme: domain.com/productname-numbers-categoryname.html

This is actually quite interesting thing to think about. Not the SEO part, but how to make ZF understand these kind of URLs. The default routing in Zend Framework works very well for typical Zend'ish URLs like domain.com/hello/world/stuff/goes/here, but if you want to do some more specialized URLs, like the example here, you may need to do some thinking.

Because ZF is so flexible, I can think of four different ways to route complex URLs:

  • Using __call

  • Using a controller plugin

  • Using Zend_Controller_Router_Route_Regex

  • Customizing the Route class



These methods can be used for other things as SEO URLs as well, so let's check out how to utilize these four and their pros and cons.

Read the rest of the post at codeutopia.net

Zend Framework initialization shell scriptsGeek humor

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies