You are here:  » remove text

Support Forum



remove text

Submitted by philstone on Fri, 2006-10-13 14:26 in

Hi Dave

was wondering is there a shortcut to removing the following text

Product search results for merchant:24 Electric: (showing 21 to 30 of 127)

Currently the text used in the search.php file is

".htmlentities($q,ENT_QUOTES,$config_charset)."

What would i change this to for the merchant: to dissappear?

Regards

phil

Submitted by support on Fri, 2006-10-13 14:53

Hi Phil,

To just remove merchant: you can do it inline; as follows:

".htmlentities(str_replace("merchant:",""$q),ENT_QUOTES,$config_charset)."

Cheers,
David.

Submitted by philstone on Fri, 2006-10-13 15:08

hi dave

when i use that piece of script i get this error

Parse error: parse error, unexpected T_VARIABLE in /home/buy247/public_html/search.php on line 94

Regards

phil

Submitted by support on Fri, 2006-10-13 15:34

Ooops - missing comma, sorry!

".htmlentities(str_replace("merchant:","",$q),ENT_QUOTES,$config_charset)."

Cheers,
David.

Submitted by philstone on Fri, 2006-10-13 15:45

thnks dave

last question for today

how would i go about removing merchant: from

<?php
 
print ($q); 
?>

in the html/searchresults.php

Regards

phil

Submitted by support on Fri, 2006-10-13 15:55

Hi Phil,

More or less the same trick.....

<?php
 
print str_replace("merchant:","",$q);
?>

Cheers,
David.

Submitted by Diana on Thu, 2007-10-04 22:06

Can this also be used to remove "brand:" and "category:"?
I tried
.htmlentities(str_replace("merchant:","brand","category",$q),ENT_QUOTES,$config_charset).
but that just made the whole search result name disappear.

I thought perhaps the empty set of quotes ("merchant:","",$q)was to add additional names above, but that didn't work unless I made a typo.
Thanks, Diana

Submitted by support on Fri, 2007-10-05 07:33

Hi Diana,

You're close - to replace multiple strings in one call to str_replace(), you have to provide each search string in an array, so this would work:

htmlentities(str_replace(array("merchant:","brand:","category:"),"",$q),ENT_QUOTES,$config_charset)

Cheers,
David.

Submitted by Diana on Sun, 2007-10-07 03:00

Great, thanks. Diana