I’ve built a custom CMS that does the usual things: post management, content management, contact management, etc.
In the post management section, I would like to extract the “Title” field and convert this into a URL-ready form.
Example: New post is created titled “3 Ways to Win in Real Estate & in Life”. I want this to run through a PHP script that turns it into “3_ways_to_win_in_real_estate_&_in_life”.
Anyone have a script for this, or would url_encode() do all of this for me?
Make use of currently developed code that you can use within your own projects.
Kohana 3 framework has solution for you. Below you can find solution on the basis of URL::title() method from Kohana 3 framework: