musiconly |
|
---|---|
Hey guys, I got stuck... again..
![]() Here's the thing, since I have 10,000+ pages and around 50 of them have alias, I want to auto create alias from page title. I want to do this because of few reasons: 1. Improve current SEO 2. Prepare database for Cotonti(yep, still using Sed125) - my nice urls will look like site.com/category/alias Anyways, I'm not even a mediocre PHP programmer so don't laugh at my approach. It's almost working ![]() Basic idea (since my titles consist of croatian letters like č,ć,š,ž,đ): Turn: Đorđe Balašević - koncert u Šibeniku into: Dorde_Balasevic_koncert_u_Sibeniku What's wrong? Well, I get this kind of output: Đorđe Balašević opet u Kerempuhu - Đorde_Balasevic_opet_u_Kerempuhu_22 Šta ćeš bez mene? - Šta_ces_bez_mene_28 And it should be Đorđe Balašević opet u Kerempuhu - Dorde_Balasevic_opet_u_Kerempuhu_22 Šta ćeš bez mene? - Sta_ces_bez_mene_28 As you can see, output IS case sensitive, and it shouldn't be since I'm using str_ireplace. Right? I don't get it ![]() And second thing, has anyone created this "plugin" already and is willing to share it ![]() Thanks in advance! |
GHengeveld |
|
---|---|
You could make it all lowercase first. But then you won't have capitals in your url.
I'm sure there's an existing solution for this problem that I just don't know about. |
musiconly |
|
---|---|
$rec = strtolower($rec)
outputs: Đorđe Balašević opet u Kerempuhu - �orde_balasevic_opet_u_kerempuhu_22changed format from ansi, to uft8 without bom, utf8.. and still weird char:S |
Kilandor |
|
---|---|
Lombi has a solution from this that uses javascript. I'm sure he will post it when he see's this, It may already be posted somewhere I think?
|
musiconly |
|
---|---|
The only thing he posted was auto-create alias when adding new entry. I'm talking about creating the alias for the things that are already in database.
|
GHengeveld |
|
---|---|
Basically this is about replacing strange non-Latin-1 with their Latin-1 look-a-likes.
|
musiconly |
|
---|---|
... in case non-latin chars are present in string, and using that converted string as a page alias
![]() seems to me i'll have to add capitalized letters in that replacement array ![]() |
Lombi |
|
---|---|
lol i really dont get your problem. it replaces the small characters fine cause you put them in. it doesnt do anything to the big characters cause you HAVENT PUT THEM IN
![]() just make another line, using BIG CHARACTERS ![]() <a href="http://www.domenlo.com">Surreal Art</a>
|
musiconly |
|
---|---|
I'm using str_ireplace — Case-insensitive version of str_replace, so I guess I wouldn't need to put the capitalized ones in my array.
Since I haven't found solution for this specific problem, I included capitalized letters in array ![]() |
Lombi |
|
---|---|
Yeah, on paper it sounds logical, however my own testing showed that php does not recognise those characters as lowercase versions of the other (and vice versa). So we've been doing dual-case replaces ever since.
<a href="http://www.domenlo.com">Surreal Art</a>
|