You are here:  » Modifying tapestry.php


Modifying tapestry.php

Submitted by madstock on Wed, 2006-03-22 15:16 in

Hi,

As you may remember I caused a kerfuffle when trying to utilise non-standard characters (e.g. accents etc), and one part of the solution was to modify the tapestry.php file removing:

$text = preg_replace('/[^A-Za-z0-9'.$allow.' ]/e','',$text);

- which is an aggressive text normalisation command...

However, I now find that some of the products contain quotes " and ' in the product title - clicking on these products results in a "no products found", as I presume the quotation marks act as - quotation marks, and "cut off" the quoted part of the text. A good example of this can be seen at:

http://www.blumen.madstock.de/search.php?q=merchant:Douglas+Parfumerie:

(Douglas Parfumerie are a German perfume company who apparently love quotation marks)

Therefore, would it be possible to change the above tapestry.php line, so that quotation marks only are removed? I have tried setting up a find-and-replace filter (to replace quotation marks with nowt), but it doesn't work?

On a slightly different note, a thought that has just came to me is for "universal filters" (i.e. filters that apply to every feed that is imported) - would this be a possibility for the upcoming version?

Thanks in advance for any help,

Duncan

madstock.com

Submitted by support on Wed, 2006-03-22 16:05

Hi Duncan,

I see from that page that you have changed the normalisation function to allow ' and " through - the problem is now reading it back on the product page... am I understanding that correctly?

Submitted by madstock on Wed, 2006-03-22 16:47

Indeed, that would be the crux of it - I would like to change back the normalisation so that it doesn't allow ' and " , but allows foreign characters. Thanks for making me put it succinctly!

madstock.com

Submitted by support on Wed, 2006-03-22 17:25

Could you have a go with this version which is from the new version of Price Tapestry...

<?php
  
function tapestry_normalise($text,$allow "")
  {
    
$text str_replace("-"," ",$text);
    
$text preg_replace('/[^A-Za-z0-9'.chr(0x80).'-'.chr(0xFF).$allow.' ]/e','',$text);
    
$text preg_replace('/[ ]{2,}/',' ',$text);
    return 
$text;
  }
?>

Submitted by madstock on Wed, 2006-03-22 18:27

Thanks - that appears to have sorted it.

Duncan

madstock.com