Tag: regex

drupal 6, tagadelic cache clear

I’ve got some problem with the tagadelic module in Drupal 6.x to create tag clouds. Even having removed the “cache” from the site setting, when a new post was published, the clouds didn’t change, never!

At the end I’ve fount a little patch on the web and I’m trying here to explain it to new users, not familiar with patch.

  1. go into the module directory “sites/all/modules/tagadelic” and open the file tagadelic.module with your favourite editor
  2. goto line 215 (or around there) and change the line “
    $cache = cache_get($cache_name);" to $cache = cache_get($cache_name, 'cache_block');<br /></pre></li><li>goto line 228 and do the same: change<br /><pre>cache_set($cache_name, $tags); to <br />cache_set($cache_name, $tags, 'cache_block', CACHE_TEMPORARY);

upload the file and the problem will magically disappear.

Original source thanks to: http://drupal.org/node/231030

drupal 6, tagadelic cache clear

PHP convertire apostrofo in apice

Copiando un testo da MS Word in una form capita a volte di imbattersi negli apostrofi di tipo ” ’ ” che difficilmente vengono convertiti correttamente in UTF-8. Questo capita (leggendo un po’ di bug report di php) con alcune versioni di php.

Brutale mna efficace al scelta di convertire tutti questi apostrofi con il singolo apice ‘

  $patterns[0] = ‘/[\x82\x91\x92]/’;
  $replacements[0] = “‘”;
  $txt = preg_replace($patterns, $replacements, “Governatore d’Italia”);

che renderà “Governatore d’Italia”

PHP convertire apostrofo in apice