Welcome Guest, Not a member yet? Register   Sign In
[ASK] How to change capitalize to lowercase and replace spacing with underscores
#1

[eluser]senz[/eluser]
Hi all,
I wanna ask something, how to change capitalize to lowercase and how to replace spacing with underscore?... Because i wanna change the title of my article into database and convert them. Ex : My New Article -> change to -> my_new_article.

Is there any function in codeigniter and how to implement into controller?
#2

[eluser]sharpe[/eluser]
Plain old php
Code:
strtolower(str_replace(" ","_",$str))
#3

[eluser]Derek Allard[/eluser]
Sharpe has a good solution, but you might also want to look at url_title(), which is my preferred approach.

http://ellislab.com/codeigniter/user-gui...elper.html
#4

[eluser]senz[/eluser]
[quote author="Derek Allard" date="1277215336"]Sharpe has a good solution, but you might also want to look at url_title(), which is my preferred approach.

http://ellislab.com/codeigniter/user-gui...elper.html[/quote]

I just read the URL Helper as you recomended and finally i can solved my problem after read the url_title() at URL Helper Guide.
Thanks Derek Smile




Theme © iAndrew 2016 - Forum software by © MyBB