Hi,
I'm trying to set it up so in product.php I have a image link to the merchant that changes if the price is on zero. I can get it working with just images but when I insert the dynamic link it all goes pear shaped!
I'm a total php newbie so this is probably way off
<?php
if ( $mainProduct["price"] > 0 ) {
echo "<a target='_BLANK' href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?>><img src='logos/1.gif' width='100' height='30' alt='blah' border='0' /></a>";
} else {
echo "<a target='_BLANK' href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?>><img src='logos/2.gif' width='100' height='30' alt='blah blah' border='0' /></a>";
}
?>
Hi David,
I can get the images working fine it's just when I add the links to the code I get:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/conversi/public_html/blah/html/product.php on line 51
Line 51 being:
echo "<a target='_BLANK' href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?>><img src='logos/1.gif' width='100' height='30' alt='blah' border='0' /></a>";
Cheers,
Chris.
Hi Chris,
As it's in PHP mode already at that point there's no need for the additional tags - have a go with just:
echo "<a target='_BLANK' href='".tapestry_buyURL($priceProduct)".' ". javascript_statusBar(translate("go to")." ".$priceProduct["merchant"])."><img src='logos/1.gif' width='100' height='30' alt='blah' border='0' /></a>";
Cheers,
David.
Hi David,
Now I get:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/conversi/public_html/trademymobile.co.uk/mobile-phone-recycling/html/product.php on line 51
Cheers,
Chris.
Hi,
The code actually looks fine - but if you're working with re-written URLs (e.g. /product/product-name.html) the img src would need to be...
src='/logos/1.gif'
(assuming that /logos/ is in the top level folder)
Otherwise, it would depend on the location in product.php - if you're not sure if you could email me your modified file I'll check it out for you...
Cheers,
David.