CodeIgniter Forums
Convert input to alias - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Convert input to alias (/showthread.php?tid=28617)



Convert input to alias - El Forum - 03-16-2010

[eluser]Iwasignited[/eluser]
Hello,
Im writing a blog application as my first PHP app with CI.
I have a question.
When the administrator posts a new entry with title, body. I want to convert the title input to alias and store it in my database in order to make the URL nicer with SEO.
For example: My First Entry -> my-first-entry or something like that.

Please help me.
Thanks.


Convert input to alias - El Forum - 03-17-2010

[eluser]Mareshal[/eluser]
I am telling you what to do, and you implement it Smile.

clean your URL of ", ', 's and other buggy chars
break your url into pieces depending on  ( ) - space, explode()
foreach on your array and make a new string, by adding "-".