Welcome Guest, Not a member yet? Register   Sign In
Numbers in URL Titles
#1

[eluser]ShoeLace1291[/eluser]
I need to restrict the use of numbers in the url_titles function. I need it to convert numbers in a title to the actual word(example: Halo 3 would convert to Halo-Three, Halo 2=Halo-Two, etc). Is there an extension of the url helper that I could use to do this? If not, could somebody write me a code?
#2

[eluser]n0xie[/eluser]
Did you try google ?
#3

[eluser]OliverHR[/eluser]
What kind of anwser is that??.

Sorry ShoeLace I cant help you much. Maybe you can use URI routing and Regular Expressions.
#4

[eluser]danmontgomery[/eluser]
[quote author="OliverHR" date="1264631545"]What kind of anwser is that??.[/quote]

obviously didn't click on the link...


A simple solution:
Code:
function num_to_str($str) {
  $numbers = array( "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" );
  return str_replace( array_keys($numbers), array_values($numbers), $str );
}
#5

[eluser]saidai jagan[/eluser]
SUPER Wink Very Cheeky......
#6

[eluser]ShoeLace1291[/eluser]
Will this work if there are other words in the string?
#7

[eluser]ShoeLace1291[/eluser]
i need to figure out a way to modify the url_title function in code igniter.




Theme © iAndrew 2016 - Forum software by © MyBB