Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with a line of code please


bigbob2

Recommended Posts

Hi there, I have added an extra info box to the right hand side, but I just dont know how to get the image on the box to link to a page. The code I have used for the info box is below, can anyone tell me how to make the image link to a page? I dont need to make it fancy-pants with multiple languages etc. I just want to code the image to link to another page.

 

Thanks in advance

Kev

 

 

============================================================

<?php

?>

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_VOUCHERS);

new infoBoxHeading($info_box_contents, false, false);

$info_box_contents = array();

$info_box_contents[] = array('align' => 'center','text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents">' . tep_image(DIR_WS_IMAGES . 'voucher.jpg') . '</a></td></tr></table>');

$info_box_contents[] = array('text' => 'Gift Vouchers<br>');

new infoBox($info_box_contents);

?>

</td>

</tr>

============================================================

Link to comment
Share on other sites

Hi Kev,

 

If you want it to link to a page on your website use the following:

 

<?php
?>
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_VOUCHERS);
new infoBoxHeading($info_box_contents, false, false);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center','text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents">' . '<a href="' . tep_href_link('newpage.php') . '">' . tep_image(DIR_WS_IMAGES . 'voucher.jpg') . '</a></td></tr></table>');
$info_box_contents[] = array('text' => 'Gift Vouchers<br>');
new infoBox($info_box_contents);
?>
</td>
</tr>

 

As you can see i've added a new link in there....with the tep_href_link function it will ensure sessions aren't lost when navigating through your site ... i've added newpage.php as an example...u can use whatever you want ... but make sure the page you are linking to exists in your catalog root

 

If you want to link it to an external page (not a page on your site) ... use the following:

 

<?php
?>
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_VOUCHERS);
new infoBoxHeading($info_box_contents, false, false);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center','text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents">' . '<a href="http://www.google.com" target="_blank">' . tep_image(DIR_WS_IMAGES . 'voucher.jpg') . '</a></td></tr></table>');
$info_box_contents[] = array('text' => 'Gift Vouchers<br>');
new infoBox($info_box_contents);
?>
</td>
</tr>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...