2010-06-21 137 views
0

我認爲這是一個路由問題。symfony路由問題?

對於SEO的原因,我需要的網址如下所示:

www.domain.com/acme-pump.html www.domain.com/beta-pump.html www.domain.com/boyden -pump.html ...

也:

www.domain.com/acme-pumps.html www.domain.com/beta-pumps.html www.domain.com/boyden -pumps.html

(注意泵上的「s」)。

大約有千種品牌名稱,如頂極,貝他和博伊登。我需要從數據庫中出來的「acme」,「beta」,「boyden」部分 - 「泵」或「泵」部分可以用硬編碼。

顯然,我無法爲每個品牌創建一個單獨的模塊。

我一直認爲這是一個路由問題,但我沒有試過 routing.yml工程。也許我有錯誤的想法?

任何線索都會受到感謝。

感謝,

約翰

回答

0
## All your normal routing rules first. 

product:    { url: /:slug, params: { module: Whatever, action: whatever } } 

然後從數據庫中查找的東西,如:

$product = Doctrine::getTable('Product')->findOneBySlug($request->getParameter('slug'));