CodeIgniter Forums
create url's - 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: create url's (/showthread.php?tid=32876)



create url's - El Forum - 08-08-2010

[eluser]bralens[/eluser]
How can i convert
Code:
My new post title with weird symbols āčēģīķļž
to
Code:
my-new-post-title-with-weird-symbols-acegiklz
?

and what i need to write in .htaccess to get this url?
Code:
http://example.com/my-new-post-title-with-weird-symbols-acegiklz



create url's - El Forum - 08-09-2010

[eluser]iConTM[/eluser]
This may work:

Code:
$title = "What's wrong with CSS?";

$url_title = url_title($title);

// Produces: Whats-wrong-with-CSS

http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html


create url's - El Forum - 08-09-2010

[eluser]bralens[/eluser]
url_title() do not convert characters like āēčīžķ....
it will convert
Code:
My new post title with weird symbols āčēģīķļž
to
Code:
My-new-post-title-with-weird-symbols
but i realy need these simbols to be there


create url's - El Forum - 08-10-2010

[eluser]mddd[/eluser]
If you are using CodeIgniter 2.0 you can use the convert_accented_characters function from the text helper.
If you are using 1.7.2, I would suggest extending the url helper to include the functionality from the convert_accented_characters function from 2.0.


create url's - El Forum - 08-10-2010

[eluser]Clooner[/eluser]
Code:
function removeaccents($string)
{
  return strtr($string,
"ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝß
àáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
"SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
}
I see that some characters are missing though! Add them in case you need them. There are many functions like this in the forum!


create url's - El Forum - 08-10-2010

[eluser]bralens[/eluser]
thanks
and haw can i get url without controller and function names in it?


create url's - El Forum - 08-10-2010

[eluser]Clooner[/eluser]
[quote author="bralens" date="1281463738"]thanks
and haw can i get url without controller and function names in it?[/quote]
Look up Routes in the manual