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
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
Ooops - missing comma, sorry!
".htmlentities(str_replace("merchant:","",$q),ENT_QUOTES,$config_charset)."
Cheers,
David.
thnks dave
last question for today
how would i go about removing merchant: from
<?php
print ($q);
?>
in the html/searchresults.php
Regards
phil
Hi Phil,
More or less the same trick.....
<?php
print str_replace("merchant:","",$q);
?>
Cheers,
David.
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
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.
Hi Phil,
To just remove merchant: you can do it inline; as follows:
".htmlentities(str_replace("merchant:",""$q),ENT_QUOTES,$config_charset)."
Cheers,
David.