Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Image Map


xecutech

Recommended Posts

I am still learning php, but have run into a small problem. How would I take the image in the header and make it an image map?

Below is the line of code in the header file and the image coordinates I need to put in. I would be eternally grateful for any help, and yes, I did a search here first.

 

<?php echo tep_image(DIR_WS_IMAGES . 'image.jpg', 'name'); ?>

 

<map name="imagemap">

<area shape="rect" coords="380,104,466,133" href="http://www.site.com">

<area shape="rect" coords="474,104,614,133" href="http://www.site.com/catalog">

<area shape="rect" coords="627,104,716,134" href="http://www.site.com/forum">

</map>

Link to comment
Share on other sites

  • 3 months later...

I was wondering the same thing, if I put it in like an html it dont show up as an image map with the locations, if anyone could help or point us to a site or somone that would know...

 

Thanks

Tazmear <- What is it????

Link to comment
Share on other sites

Just rewrite some code in the tep_image function that will allow you to add the name of the map you want to use and then simply add the map info at the top of the page and define it such as:

$map_name = 'imagemap';
<map name="imagemap"> 
<area shape="rect" coords="380,104,466,133" href="http://www.site.com"> 
<area shape="rect" coords="474,104,614,133" href="http://www.site.com/catalog"> 
<area shape="rect" coords="627,104,716,134" href="http://www.site.com/forum"> 
</map>';

then call upon your newly edited function in this type of manner:

<?php echo tep_image(DIR_WS_IMAGES . 'your_image.jpg', 'Your ALT text', $map_name); ?>

 

HTH,

-Chris

Chris Sullivan

Link to comment
Share on other sites

ok next question, what files do I put those in? I know this part that you call it <?php echo tep_image(DIR_WS_IMAGES . 'your_image.jpg', 'Your ALT text', $map_name); ?> goes in the index.php

 

BUT where does the $map_name = 'imagemap';

<map name="imagemap">

<area shape="rect" coords="380,104,466,133" href="http://www.site.com">

<area shape="rect" coords="474,104,614,133" href="http://www.site.com/catalog">

<area shape="rect" coords="627,104,716,134" href="http://www.site.com/forum">

</map>'; GOES???

 

Thanks again

Tazmear <- What is it????

Link to comment
Share on other sites

You have to edit the tep_image function. I believe it is found in the /includes/functions/html_output.php file.

 

You will have to edit the function to allow for the name of the imagemap.

 

From there.....you just call it, and add your definitions.....I would assume that the header images are going into the header....therefore, I would define the imagemap name, and add the tep_image code in the header.php file, and include the image map definitions in the footer.php file

 

HTH

-Chris

Chris Sullivan

Link to comment
Share on other sites

  • 2 weeks later...

I have been trying to implement the image map idea by using the main category images as a source, also. I see how the header aspect works with one image but I would like all sub categories to be accessed from the main category. Reasoning behind this is sub cats go 3 to 4 levels and the map on the header could not be large enough to include that many locations (ie. header = world, mains = continents, subs = countries, etc.). This is the basis of my existing site, but it is all in html and the deepests subs really do exist, so it was easy to define the relative paths. Any help in this matter would be greatly appreciated!

www.djscollectables.com

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...