Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I add/change links[+ apply them to an image]?


Guest

Recommended Posts

..and by 'don't know much' I mean: don't know anything....

 

 

Can someone please explain how I go about adding a link to an image in PHP? (I've added an image to my store index page that I want to link to one of my categories.)

 

Thanks.

 

I.L.L.

Link to comment
Share on other sites

An example from the stock osC header.php file:

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?>

In that code:

 

FILENAME_DEFAULT is the page to link to (that item is defined in your filenames.php file)

 

store_logo.png is the image name.

 

STORE_NAME is what get's displayed on a "mouseover". You could use something like 'Click here to see my category' in it's place.

 

If you wanted to link to a particular category

 

This code:

 

tep_href_link(FILENAME_DEFAULT)

 

Would need alterd to something like:

 

tep_href_link(FILENAME_DEFAULT, 'cPath=21')

 

Using the correct value for cPath to fit the category you want to link to.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

An example from the stock osC header.php file:

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?>

In that code:

 

FILENAME_DEFAULT is the page to link to (that item is defined in your filenames.php file)

 

store_logo.png is the image name.

 

STORE_NAME is what get's displayed on a "mouseover". You could use something like 'Click here to see my category' in it's place.

 

If you wanted to link to a particular category

 

This code:

 

tep_href_link(FILENAME_DEFAULT)

 

Would need alterd to something like:

 

tep_href_link(FILENAME_DEFAULT, 'cPath=21')

 

Using the correct value for cPath to fit the category you want to link to.

 

 

 

Thanks, I'll try that out later tonight.

Link to comment
Share on other sites

I tried adding that line of code..but..it didnt work. I tried to just add the link part of the code to my existing code, so I'm assuming it doesnt mix with what is already there.

 

Here is my code[minus some stuff that I don't think has anything to do with the image/link]:

 

<?php


define('TEXT_MAIN', '<br><font color="#ff0000"><b>Just click the Category Icon below to browse our products.</b></font> <br><br><table border="0" width="100%" cellspacing="25" cellpadding="2"><tr><td class="main" valign="middle">'<a href="' . tep_href_link(FILENAME_DEFAULT,'cPath=21') . '">' . tep_image(DIR_WS_IMAGES . 'default/Shirts.jpg') . '</a>'</td>');

?>

 

 

Can someone please tell me what I need to do to make the link work?

 

Thanks.

Link to comment
Share on other sites

but..it didnt work

That can mean a bazillion things....

:huh:

 

Care to post (or PM me) a link so I can see what's going on?

:unsure:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

<?php
define('TEXT_MAIN', '<br><font color="#ff0000"><b>Just click the Category Icon below to browse our products.</b></font> <br><br>
<table border="0" width="100%" cellspacing="25" cellpadding="2">
<tr>
 <td class="main" valign="middle">
<a href="' . tep_href_link(FILENAME_DEFAULT,'cPath=21') . '">' . tep_image(DIR_WS_IMAGES . 'default/Shirts.jpg') . '</a>
 </td>');
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...