I know what you mean, and that thought had crossed my mind. This isn't actually for a blog, so page titles are less likely to be changed. The reason I was worried about titles changing was as you pointed out - the search engines, so that's why I hacked together a solution so the slugs cannot be updated once set.
I hadn't come across Inflector (fairly new to cake and still learning!) - just checked it out, the code I posted was taken from various different places and wasn't actually mine. It is an easier way but unfortunately it doesn't produce as good a result as using the php functions. E.g. uppercase is allowed, apostrophes are turned into hyphens. It is a messier way of doing things but it allows greater control in my opinion. Blog looks cool as well :) Still not sure how I can stop this code from running during the edit functions.... I need to over-ride the before validate function in the app model... On May 23, 5:55 pm, DanielMedia <[email protected]> wrote: > I had a similar idea with regard to url slugs for my blog but > ultimately decided that it would be a bad idea. I tend to tweak titles > of articles as I expand on them so then I would have to worry about > Google indexing the old title and then having to 301 redirect to the > new title. Or people bookmarking an old title etc. It just gives much > less flexibility to change the page title on the fly. I ended up just > going with a url likehttp://domain.com/content/$id/my-cool-page-title/. > Here's an example on my blog (Still in > development)http://code621.com/content/5/a-new-cakephp-community. > > Btw, for your slug function, why not just use: Inflector::slug > ($pageTitle, '-') . '.html'; > > You can change it to add your page numbering jammy. But that's a > cleaner way to slugify. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
