Hi,
Is there a way I can take the - character out of the name of 'products' in the window title? The code I am using is:
$header["title"] = "".$_GET["q"]." Coupons, ".$_GET["q"]." Cashback, ".$_GET["q"]." Rebates, ".$_GET["q"]." Points & Frequent Flyer Miles | RewardsDB.com";
if you look at http://rewardsdb.com/product/Frames-Direct.html you can see it displays as "Frames-Direct" - i'd like it to display as "Frames Direct".
Thanks
hmm,
I switched it to;
$header["title"] = "".$q." Coupons, ".$q." Cashback, ".$q." Rebates, ".$q." Points & Frequent Flyer Miles | RewardsDB.com";
and still see the "-" character...
Hi Andrew,
What line of products.php are you adding your code? The "-" characters are removed from $q by the following code, which is line 4:
$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");
I'm not sure why the "-" are surviving in your code; but it does depend where it is. You can always remove the "-" manually and not rely on it being done elsewhere, and as we know that $_GET["q"] holds the product names with hyphens, I would just use something like this:
$pname = str_replace("-"," ",$_GET["q"]);
$header["title"] = "".$pname." Coupons, ".$pname." Cashback, ".$pname." Rebates, ".$pname." Points & Frequent Flyer Miles | RewardsDB.com";
That should definitely do the trick....!
Cheers,
David.
Ah - the de dashing line was on line 24 and my title set was on line 4 - so I just moved the de-dasher up above the title and it now works.
Thanks again,
Andrew
Follow up question - how can I add the description from the database to the meta tags for a product?
Hi Andrew,
The description meta tag for product pages is set by the following code on line 52 of products.php:
$header["meta"]["description"] = translate("Price search results for")." ".htmlentities($q,ENT_QUOTES,$config_charset);
To add the description, change this as follows:
$header["meta"]["description"] = translate("Price search results for")." ".htmlentities($q,ENT_QUOTES,$config_charset)." ".htmlentities($product["products"][0]["description"],ENT_QUOTES,$config_charset);
Hope this helps,
Cheers,
David.
Hi,
I added the code but its not displaying. What code needs to be before that statement for it to work?
Andrew
Hi Andrew,
There shouldn't need to be any more code added. If you would like to email me a copy of your modified products.php i'll take a look for you...
Cheers,
David.
Hi Andrew,
If you use $q instead of $_GET["q"] you should have the product name without the hyphens. $q is preserved through the script as the value of the ?q= on the URL, so it should work fine.
Cheers,
David.