Posts

Showing posts from February, 2012

Zend Controller Action with Named Parameters

NOTE: The following code is taken directly from Zend Developer Zone, as posted and described by NirTayeb and some of the comments on that page. Refer to the original source for a full explanation of how it works and to thank the original author. I am only re-posting here to make it more accessible.
-------------------------------------------------------------------------------------------
Say you have a url like the following:

http://domain.com/products/view-product/product_id/15 If you're using the Zend Framework, the default interpretation of this URL is as follows: no named module, so assume the default moduleproducts must be the controller, so look for a ProductsController classview-product must be the action, so look for a method called viewProductAction() in the ProductsController classexecute the viewProductAction(), then try to run the corresponding views/scripts/products/view-product.phtml script To access the product_id in your viewProductAction() method, you typically do …