![]() |
Formatting blog titles for easy url viewing - 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: Formatting blog titles for easy url viewing (/showthread.php?tid=10046) |
Formatting blog titles for easy url viewing - El Forum - 07-17-2008 [eluser]Bramme[/eluser] Hey all I'm trying to format blog titles into strings that can be used in the url. I know I have to use preg_replace, but I've never used regular expressions really and what I'm trying to do is throwing errors. I first want to strip all non essential characters like '.,?!' etc... and then replace spaces with a dash (-). So far I have this: Code: preg_replace('{[ \t]+}', '-', preg_replace('.|?|!', '', $row['title'])) Nevermind, found out that the url helper has a function for this. Formatting blog titles for easy url viewing - El Forum - 07-17-2008 [eluser]Bramme[/eluser] reduced the size because the problem was solved and no longer important... I always do that when I don't have the option of deleting my topics... |