Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

image map


Tazmear

Recommended Posts

ok, maybe someone can help me out, I know nothing about php, BUT IM LEARNING :huh: I put this routine in the html_output.php file

 

 

////

// image map

$map_name = 'imagemap';

<map name="imagemap">

<area shape="rect" cords="555,74,704,96" href="http://www.site.com/services/favorites.shtml">

<area shape="rect" cords="555,42,687,70" href="http://www.site.com/services/phone.shtml">

<area shape="rect" cords="555,0,685,34" href="http://www.site.com/services/email.shtml">

<area shape="rect" cords="306,100,414,124" href="http://www.site.com/shopping/catalog/shopping_cart.php">

<area shape="rect" cords="219,100,296,124" href="http://www.site.com/shopping/catalog/checkout_shipping.php">

<area shape="rect" cords="114,100,208,122" href="http://www.site.com/shopping/catalog/account.php">

</map>';

 

Ok I don't know if thats right but thats what i did so far,

 

NEXT:

 

I needed an include do load the map and the cords this I put in the header.php file like so

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'du.gif', 'welcome',$map_name) . '</a>'; ?>

 

but then i get this error:

 

Parse error: parse error in /home/sites/site2/web/shopping/catalog/includes/header.php on line 12

 

 

can someone tell me what I did wrong? where I call the dir_ws_image is the line getting the error.

Tazmear <- What is it????

Link to comment
Share on other sites

The first part is an unholy mix of PHP and HTML, and I fail to see the need for doing this. Stick with this part:

<map name="imagemap">
<area shape="rect" cords="555,74,704,96" href="http://www.site.com/services/favorites.shtml">
<area shape="rect" cords="555,42,687,70" href="http://www.site.com/services/phone.shtml">
<area shape="rect" cords="555,0,685,34" href="http://www.site.com/services/email.shtml">
<area shape="rect" cords="306,100,414,124" href="http://www.site.com/shopping/catalog/shopping_cart.php">
<area shape="rect" cords="219,100,296,124" href="http://www.site.com/shopping/catalog/checkout_shipping.php">
<area shape="rect" cords="114,100,208,122" href="http://www.site.com/shopping/catalog/account.php">
</map>

This is all pure HTML. Paste it somewhere in the body section of your page, ahead of your image. If you need this to be on multiple pages, stick it in the header.php (in an HTML section) or put it in a file of its own and use the PHP Require command to include it at the right spot.

 

For the image use this format:

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'du.gif', 'welcome',,,'USEMAP="#imagemap" ') . '</a>'; ?>

If you want to know what the parameters are for tep_image, look at the definition in html_output.php.

 

If you are still having problems just post here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

ok thanks for helping me. :D I changed everything like you said but I still get the same error. What else do you think I could do and can you explain to me what the error means?

Tazmear <- What is it????

Link to comment
Share on other sites

That means the PHP parser can't understand something on Line 12 of header.php. Usually this is a missing character, or one used in the wrong place. You could start by comparing it to the original (unmodified) file. If you can't figure it out, please post a few lines of the file -- say lines 10-15 -- and we'll take a look at it.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

ok where in my html_output.php do I add this??

 

 

<map name="imagemap">

<area shape="rect" cords="555,74,704,96" href="http://www.site.com/services/favorites.shtml">

<area shape="rect" cords="555,42,687,70" href="http://www.site.com/services/phone.shtml">

<area shape="rect" cords="555,0,685,34" href="http://www.site.com/services/email.shtml">

<area shape="rect" cords="306,100,414,124" href="http://www.site.com/shopping/catalog/shopping_cart.php">

<area shape="rect" cords="219,100,296,124" href="http://www.site.com/shopping/catalog/checkout_shipping.php">

<area shape="rect" cords="114,100,208,122" href="http://www.site.com/shopping/catalog/account.php">

</map>

 

when i add this part it gets the error:

 

,,,'USEMAP="#imagemap" to this line below.

 

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'du.gif', 'welcome',,,'USEMAP="#imagemap" ') . '</a>'; ?>

 

sorry for all the questions, but im trying to learn this.... :unsure:

Tazmear <- What is it????

Link to comment
Share on other sites

Don't put the first part in html_output.php; that is all PHP code. Put it in header.php, just after the first ?>.

 

If the second part is giving you an error, try it this way:

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'du.gif', 'welcome','','','USEMAP="#imagemap" ') . '</a>'; ?>

If you get an error message please copy the entire message and paste it here. It helps in finding out where the problem is. And don't worry about asking questions if it helps you learn. That's what they are for.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

You can have HTML in files other than the header.php; most of the files in your Catalog directory contain HTML. Header.php is just a convenient place to put anything that has to be at the top of every page, such as the logo. I assumed that was what you were using your imagemap for, so that's a good place for it.

 

Html_output.php is for PHP functions that generate HTML. These are the functions that are used to create links, call images, build forms, etc. Modifying one of those functions will affect many different pages (wherever the function is used) and should be done with care. The existing functions are well designed and should work as-is in most cases. Adding your imagemap was a simple matter of using the existing function's ability to accept additional parameters.

 

Good thing I'm having fun learning PHP. :D

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Ok....here goes.

 

Include this in your header.php file where you want your header image to go...

 

$map_name = 'The_name_of_your_image_map';
echo tep_image(DIR_WS_IMAGES . 'picture.jpg', 'This is the alt text.', '500', '200', 'usemap="' . $map_name . '"');

 

Then, place your map info code in the footer.php file:

  <map name="The_name_of_your_image_map">
   <area shape="rect" coords="17,248,256,270" href="index.php?cPath=31">
   <area shape="rect" coords="548,248,744,269" href="#">
 </map>

 

And that should do it.

 

*Untested.

 

-Chris

Chris Sullivan

Link to comment
Share on other sites

  • 1 year later...

Can you please tell me how I would go about just having the image map on

only certain pages, like a Category page where you would click on a product

in the image map to open its product info page? I have been trying to figure this one out for awhile, now by reading your post I'm halfway there. I hope

your still paying attention to this thread. Thanks for any help.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...