Welcome Guest, Not a member yet? Register   Sign In
Wiki style urls
#1

[eluser]Young Caveman[/eluser]
Hey guys.
I would like to implement wiki style urls, so when a user writes an article "This is an article" the system creates also a permalink automatically: "this_is_an_article". but what when i use special characters in the title (like () & èòà etc.)? Those chars are not allowed to be in the url.

So i think i have to change this in the config file:
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
But, what's the regular expression i've to use?

I'm just a newbie, and plus i can't speak english very well. I would like to know just the informations i need. Thank you in advance. Smile

Albé
#2

[eluser]xwero[/eluser]
the url helper has a url_title function that you might find useful.
#3

[eluser]Young Caveman[/eluser]
Uhm, it's very interesting, thank you. But what i mean is that when i have just the url i can also get the title. With url_title i have to assign the result to another field ("permalink" for example).

What's wrong with CSS? would become whats_wrong_with_css, but ALSO Whats wrong with CSS produces whats_wrong_with_css

Right? I would like to be able to get both title and url string with a simple rule. In wikipedia, for example " ' " is equal to % 27.
#4

[eluser]xwero[/eluser]
You can look at the code of the function and adapt it to your needs in a new function if you want. People with accented language have the most problems with this function because it strips out the accented characters.

An other option is to urlencode the url but almost nobody of the surfers is going to know what the %xx stands for. And i'm not sure if the SE spiders do any character decoding?
#5

[eluser]Young Caveman[/eluser]
[quote author="xwero" date="1221158274"]You can look at the code of the function and adapt it to your needs in a new function if you want. People with accented language have the most problems with this function because it strips out the accented characters.

An other option is to urlencode the url but almost nobody of the surfers is going to know what the %xx stands for. And i'm not sure if the SE spiders do any character decoding?[/quote]

Dunno :S

Anyway, thank you, i'll take a look to the function Smile
#6

[eluser]Jamie Rumbelow[/eluser]
Either that, or just add a permalink field to your pages table...

You can generate it really easily, and then use routing or a where() clause to pick it from the db.




Theme © iAndrew 2016 - Forum software by © MyBB