You are here:  » Function tapestry_hyphenate

Support Forum



Function tapestry_hyphenate

Submitted by coyote on Fri, 2009-10-16 02:45 in

As many feeds can have special car, i implemented a more "powerful" function called Mister Clean ;)

Find : (in includes/tapestry.php)

  function tapestry_hyphenate($text)
  {
    $text = str_replace(" ","-",$text);
    return $text;
  }

Replace by :

  function tapestry_hyphenate($text)
  {
$tofind = "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ()[]~$%*@ç;:^¨€{}|+ ";
$replac = "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn---------------E----";
$text =(strtr($text,$tofind,$replac));
$text = strtolower($text);
    return $text;
  }

at David : i think it would be good to use the same code for function tapestry_search, what do you think ?

Coyote

Submitted by support on Fri, 2009-10-16 05:20

Hi Coyote;

This shouldn't really be necessary if the site has been configured in the correct character set for the feed. Check your config.php setting for $config_charset if you are having difficulty getting these characters to display correctly. The default is;

  $config_charset = "utf-8";

...however in some cases, iso-8859-1 is required; so try:

  $config_charset = "iso-8859-1";

In situations where just one or two feeds are in the "other" character set to the majority of feeds on your site; you can use the UTF8 Encode (ISO-8859-1 to UTF-8) or UTF8 Decode (UTF-8 to ISO-8859-1) filters on the product name and descriptions fields to convert the text...

Re: the review code, that hasn't been implemented as yet but once it is i'll let you know...

Cheers,
David.