foreign alphabet characters in viewer urls

11 posts by 5 authors in: Forums > CMS Builder
Last Post: August 2, 2012   (RSS)

By sev - January 19, 2009

hi all

i am currently using seo urls including the record title field in the viewer urls to give the it a better descriptive meaning

however some of my titles will include spanish characters such as ñ, á etc - so when the system produces the url at present it simply ignores these and replaces with a -

for example

/services-detail.php/diseño-gráfico-2/

gets output as

/services-detail.php/dise-o-gr-fico-2/

is there a way for me to tell the system for the url only if it reads ñ or á to replace with a n or a instead of a - an so on...

many thanks for the support

regards sev

Re: [sev] foreign alphabet characters in viewer urls

By Dave - January 19, 2009

Hi Sev,

I thought I'd seen a php function that did that but wasn't able to find it after some searching.

A workaround would be to create a second field "filename" with the text you want displayed ("n", etc) and enter that fieldname under: Admin > Section Editors > Viewer Urls > Filename Fields.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] foreign alphabet characters in viewer urls

By sev - January 19, 2009

thanks for the quick response dave

yeah id thought along those same lines for the work around give them another field for name or keywords and limit the field to standard characters but the client didnt like it [crazy]

unless anyone else out there knows of the function or another way round i guess ill have to convince him to go with that

pity though as i can see this issue being a small limiting factor in future spanish projects

cheers

Re: [sev] foreign alphabet characters in viewer urls

By Dave - January 19, 2009

I found something that may be promising. I may be able to write a function removeAccents() to take care of this.

Can you email me CMS and FTP details to dave@interactivetools.com so we can test it on your server? Email, don't post login details to the forum.

Hope that helps.
Dave Edis - Senior Developer
interactivetools.com

Re: [flamerz] foreign alphabet characters in viewer urls

By sev - February 2, 2009 - edited: February 2, 2009

thanks very much flamerz for the function

sorry i forgot to post back into the forum the outcome on this issue

dave provided me with this code which allowed for the displaying of those foreign characters in the url itself which works a treat [:)]

<a href="/services-detail.php/<?php echo strtr( urlencode($record['name']), '+', '-') ?>-<?php echo $record['num'] ?>/" title="<?php echo $record['name'] ?>">Read more about <?php echo $record['name'] ?></a>

Re: [flamerz] foreign alphabet characters in viewer urls

By Jesus - July 31, 2012 - edited: July 31, 2012

Sorry for getting this thread back but it seems its appropriate for what I'm looking for.

Some of my article titles uses foreign characters (like ñ or accents (á,é,í,ó,ú))

Article name: ¿Como contratar a un diseñador de paginas para Internet?
Page url: http://www.mundoregio.com/accesando/Como-contratar-a-un-dise-ador-de-paginas-para-Internet-4

Thanks for this clarification or pointing me to the right direction.

I need to fix the index.php link and the article itself.

Jesus

I think this code can work for you.

function urls_amigables($url) {
// Tranformamos todo a minusculas
$url = strtolower($url);
//Rememplazamos caracteres especiales latinos
$find = array('á', 'é', 'í', 'ó', 'ú', 'ñ');
$repl = array('a', 'e', 'i', 'o', 'u', 'n');
$url = str_replace ($find, $repl, $url);
// Añadimos los guiones
$find = array(' ', '&', '\r\n', '\n', '+');
$url = str_replace ($find, '-', $url);
// Eliminamos y Reemplazamos demás caracteres especiales
$find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');
$repl = array('', '-', '');
$url = preg_replace ($find, $repl, $url);
return $url;
}

Re: [Jesus] foreign alphabet characters in viewer urls

By Jason - August 1, 2012

Hi Jesus,

The link you provided seems to work. Can you provide some more information about the problem you're experiencing?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] foreign alphabet characters in viewer urls

By Jesus - August 1, 2012

Hi Jason,

Yes, the link work but the problem its here:

Article title: Excelente compañera de viaje
URL: http://www.mundoregio.com/accesando/Excelente-compa-era-de-viaje-1

The URL replaces the letter ñ with a -

The same happens when any article contains an accent letter like á é í ó ú

So searching the forums I found this thread and that function, but I don´t know or have a clue how to implement it.

Thanks in advance for the orientation or giving me a solution to this.

Jesus

Re: [Jesus] foreign alphabet characters in viewer urls

By Jason - August 2, 2012

Hi Jesus,

There is a default plugin with CMS Builder called "Remove Accents From Viewer Links"

If you go to Admin -> Plugins you should see this under "Inactive Plugins". Click "Activate" and see if that takes care of your problem.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/