Cameron
Cameron

Reputation: 28843

CakePHP urls with unique ids

I have seen urls such as this on some CakePHP websites: http://sample.com/posts/WordPress_get_URL_based_on_page_post_name-O8C

What would the 08C part be? As on my current setup I pass the title and id to the url to give each item a nice url e.g. http://driz.co.uk/cake/portfolio/view/NA_Software-4 but my id is just a number. How would I change it to get a 3 character id that mixed numbers and letters?

Thanks

Upvotes: 0

Views: 167

Answers (1)

floriank
floriank

Reputation: 25698

I guess the tiny number is just a short slug.

If you already use integers for your records I don't see a point of adding an additional overhead to create tiny slugs. Also the tiny slug won't have always 3 characters when you get a decent amount of records. Tiny slugs make the most sense if you need a short URL like in emails or for twitter and other similar usecases.

However if you want to use them the CakeDC Utils plugin comes with a TinySluggable behavior. https://github.com/CakeDC/utils

Upvotes: 1

Related Questions