Hello David
I have the following code on my template to show random products at the bottom of each page.
<?php
// Paste your 468 x 60 or 728 x 90 Google Adsense code below. If you would rather not use Adsense or cannot use it,
// you can paste code for an advertising banner below. You can get this from whoever serves your adverts. More help
// can be found at http://www.pricetapestrytemplates.com/technical-support/
// Just paste the code below. Do not wrap it in any HTML tags. It's all done for you ;-)
print "<h2 class='featured'>Magazine Subscription Offers</h2>";
print "<div id='randomwrapper'>";
$sql = "SELECT name,image_url FROM `".$config_databaseTablePrefix."products` ORDER BY RAND() LIMIT 4";
if (database_querySelect($sql,$rows))
{
foreach($rows as $product) {
print "<div class='featuredproduct'>";
if ($config_useRewrite) { $href = $config_baseHREF."subscribe-to/".tapestry_hyphenate($product["name"]).".html"; } else { $href = $config_baseHREF."products.php?q=".urlencode($product["name"]); }
if ($product["image_url"]) { print "<p><a href='".$href."' title='".$product["name"]."'><img class='bdr' width='100' height='140' src='".$product["image_url"]."' alt='".$product["name"]."' title='".$product["name"]."' /></a></p>"; }
print "<h3><a href='".$href."' title='".$product["name"]."'>".$product["name"]."</a></h3>";
print "<span class='nobr'><a href='".$href."' title='".translate("Compare Prices")."'>".translate("Compare Prices")."</a></span>";
print "</div>";
}
}
print "</div><div class='clear'></div> ";
?>
I'm trying to work out how to change the Compare Prices link to an image ( http://www.magazinesubscription.co.uk/images/compare.JPG )
can you assist if you've got a second. I'm not used to the code above as its not mormal html (as what I'm used to).
cheers
Mally
excellent, thanks!
I've now added buttons to magazine subscription
Hi Mally,
Give it a go like this...
<?php
// Paste your 468 x 60 or 728 x 90 Google Adsense code below. If you would rather not use Adsense or cannot use it,
// you can paste code for an advertising banner below. You can get this from whoever serves your adverts. More help
// can be found at http://www.pricetapestrytemplates.com/technical-support/
// Just paste the code below. Do not wrap it in any HTML tags. It's all done for you ;-)
print "<h2 class='featured'>Magazine Subscription Offers</h2>";
print "<div id='randomwrapper'>";
$sql = "SELECT name,image_url FROM `".$config_databaseTablePrefix."products` ORDER BY RAND() LIMIT 4";
if (database_querySelect($sql,$rows))
{
foreach($rows as $product) {
print "<div class='featuredproduct'>";
if ($config_useRewrite) { $href = $config_baseHREF."subscribe-to/".tapestry_hyphenate($product["name"]).".html"; } else { $href = $config_baseHREF."products.php?q=".urlencode($product["name"]); }
if ($product["image_url"]) { print "<p><a href='".$href."' title='".$product["name"]."'><img class='bdr' width='100' height='140' src='".$product["image_url"]."' alt='".$product["name"]."' title='".$product["name"]."' /></a></p>"; }
print "<h3><a href='".$href."' title='".$product["name"]."'>".$product["name"]."</a></h3>";
print "<span class='nobr'><a href='".$href."' title='".translate("Compare Prices")."'><img border='0' src='/images/compare.JPG' /></a></span>";
print "</div>";
}
}
print "</div><div class='clear'></div> ";
?>
In other words, search and replace:
".translate("Compare Prices")."
...with:
<img border='0' src='/images/compare.JPG' />
Cheers,
David.