CakePHP - How to do reverse routing with slug?

前端 未结 4 1095
囚心锁ツ
囚心锁ツ 2021-01-13 12:12

I am using CakePHP 1.3. I have a Product model. on the DB table among others there are id and slug fields.

If I have a product that is

4条回答
  •  悲&欢浪女
    2021-01-13 12:46

    You should look at the following post regarding custom route classes.

    The slug data doesn't need to be involved with the database at all - the field is a fake field used to simplify logic and lookups. This solution allows you to reverse route slugs, without needing a slug field in the models table.

    http://42pixels.com/blog/slugs-ugly-bugs-pretty-urls

提交回复
热议问题