Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2006
    Location
    Los Angeles, CA
    Posts
    29
    Plugin Contributions
    0

    ImageMap in the logo...?

    Hey, folks.

    First off, yay me! I've finally been able to give back a bit - I just posted my first "let me help you out" response to someone asking for help on here. (Feels SO good to have done enough that I at least *somewhat* know what I'm talking about).

    Now, it's back to 'newbie status.'


    Here's the question:

    Some of you may have seen my original post regarding the layout I'm creating for my site. (If you didn't see it, browse on over to it - you'll need to have a quick look at the image on the page to get where I'm coming from).

    The site's coming along nicely...but due to the way my logo (a transparent .PNG file) overlaps the other elements, I need to keep Zen Cart from using the whole logo file as a link to the homepage. (But I'd still like part of the logo to link back to the homepage).

    Enter the ImageMap.

    I've built an imagemap (my first) to allow just a part of the logo that's non-overlapping with other elements to be an active link. In standard HTML, it looks something like this:

    <map name="UH_Logo_Map">
    <area shape="poly" alt=" " coords="-1,-2, 163,-2, 214,73, 207,133, 111,201, 48,199, -1,135, -1,1" href="http://www.upscalehomeless.com" />
    </map>

    And the corresponding <img> tag:

    <img src="images/uh_logo.png" width="246" height="314" border="0" alt="" usemap="#UH_Logo_Map">

    Looks okay, right? I've also changed my logo in the header.php file. Now my problem is getting the above code to work in the tpl_header.php file (which I AM overriding, BTW - not working on the original file). Looking at the file, I've isolated the part I need to change, but my PHP is limited enough that I don't understand exactly what's happening there.

    Here's the code for the section of tpl_header.php:

    <div id="logoWrapper">
    <div id="logo">
    <?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>


    I think the part that's throwing me off is not understanding what the functions here do (I'm guessing the "zen_image" function returns an <img> tag, but I'm really not sure).

    Sooo...can anyone give me any pointers as to how I would change the above code to insert the imagemap? (and do I need to create a separate <div> for the <map> tag so it won't interfere with the formatting of the other <div>'s?)

    Thanks!!

  2. #2
    Join Date
    Apr 2006
    Location
    Los Angeles, CA
    Posts
    29
    Plugin Contributions
    0

    Default Re: ImageMap in the logo...?

    An update: I've been tinkering, and have overridden the tpl_header.php file as follows:

    Starting on line 72, I changed this:

    [FONT="Courier New"]<div id="logo">
    <?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>[/FONT]

    to this:

    [FONT="Courier New"]<div id="logo">
    <map name="UH_Logo_Map">
    <area shape="poly" alt=" " coords="-1,-2, 163,-2, 214,73, 207,133, 111,201, 48,199, -1,135, -1,1" href="http://www.upscalehomeless.com" />
    </map>
    <?php echo zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT . ' usemap="#UH_Logo_Map"'); ?></div>[/FONT]



    Obviously, that ain't workin'. Here's the HTML that my index page is now generating:

    [FONT="Courier New"] <div id="logo">
    <map name="UH_Logo_Map">
    <area shape="poly" alt=" " coords="-1,-2, 163,-2, 214,73, 207,133, 111,201, 48,199, -1,135, -1,1" href="http://www.upscalehomeless.com" />
    </map>
    <img src="includes/templates/upscale_homeless_01/images/uh_logo_sm.png" alt="usemap=&quot;#UH_Logo_Map&quot;" title=" usemap=&quot;#UH_Logo_Map&quot; " width="246" height="314" /></div>[/FONT]

    I know. A big ol' mess.

    I removed the <a> tag from the start & end of the string, just so it wouldn't make the whole image into a link...but now I can't figure out how to get the extra usemap attribute onto the end of the <img> tag (and how to keep it from adding itself to the <alt> and <title> tags, for that matter).

    I've been to the /includes/functions/html_output.php to read over the zen_image function and see how it works...so that perhaps I'd better understand where the usemap attribute needs to be inserted in the string...but I just can't quite get my mind around it, at this point in my relatively short-lived PHP career.

    Okay, that's where I'm at right now. Thoughts? Suggestions?

    (And should I be posting this in this forum, or is it better-suited for somewhere else?)

    Thanks much!

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: ImageMap in the logo...?

    Try:

    PHP Code:
    <map name="UH_Logo_Map">
    <area shape="poly" alt=" " coords="-1,-2, 163,-2, 214,73, 207,133, 111,201, 48,199, -1,135, -1,1" href="http://www.upscalehomeless.com" />
    </map>
    <div id="logoWrapper">
    <div id="logo">
    <?php echo '<a href="' HTTP_SERVER DIR_WS_CATALOG '">' zen_image($template->get_template_dir(HEADER_LOGO_IMAGEDIR_WS_TEMPLATE$current_page_base,'images'). '/' HEADER_LOGO_IMAGEHEADER_ALT_TEXT'usemap="#UH_Logo_Map"') . '</a>'?></div>
    and be sure to set the definition for HEADER_LOGO_IMAGE to be your uh_logo.png file
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Apr 2006
    Location
    Los Angeles, CA
    Posts
    29
    Plugin Contributions
    0

    Default Re: ImageMap in the logo...?

    Hey, Dr. Byte! Seems you're answering all my Q's tonight.

    Hmmm...still some issues. I'm getting the following error:

    [FONT="Courier New"]Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in .../common/tpl_header.php on line 76[/FONT]


    Any thoughts?


    BTW, I just realized I *can* use a CSS imagemap - something I had originally considered, but decided against it as it wouldn't allow me to overlap the logo with the product container as much, since you can't use polygon imagemaps via CSS (I'm also absolutely positioning my logo to allow for the overlap, which seemed to be another potential problem with that approach).

    Well, I've been toying around with it, and found that I can make a CSS imagemap work with only a minor adjustment to the layout to correct for too much overlap. So the problem is, in essence, solved right now. (Not the most ideal way, but it works).

    So if you've got more important fires to douse, please go take care of them. But if you feel like pressing on and figuring the whole thing out, it'd be nice to have the option to do it that way...and at the very least, it'll help someone down the road looking to do something similar.

    Thanks again!

  5. #5
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: ImageMap in the logo...?

    Quote Originally Posted by LloydDobbler
    I'm getting the following error:

    [FONT="Courier New"]Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in .../common/tpl_header.php on line 76[/FONT]
    What's on line 76?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Apr 2006
    Location
    Los Angeles, CA
    Posts
    29
    Plugin Contributions
    0

    Default Re: ImageMap in the logo...?

    Sorry. I guess that would've been useful info, eh?

    line 76 is the line of PHP code you referenced in your first response -

    PHP Code:
    <?php echo '<a href="' HTTP_SERVER DIR_WS_CATALOG '">' zen_image($template->get_template_dir(HEADER_LOGO_IMAGEDIR_WS_TEMPLATE$current_page_base,'images'). '/' HEADER_LOGO_IMAGEHEADER_ALT_TEXT'usemap="#UH_Logo_Map"') . '</a>'?></div>

  7. #7
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    287
    Plugin Contributions
    3

    Default Re: ImageMap in the logo...?

    Hello,

    I am trying to achieve this same thing.
    I can't hardcode the image because the image changes depending on the language selected.

    I tried doing what was suggested but the image map still isn't working.
    I also tried removing the default php link on the logo so it is possible that I messed something up.

    Code:
    <div id="logoWrapper">
    <div id="logo">
    <map name="logo_Map">
    <area shape="rect" alt="" coords="568,164,748,190" href="index.php?main_page=contact_us">
    <area shape="rect" alt="" coords="374,164,560,190" href="index.php?main_page=shippinginfo">
    <area shape="rect" alt="" coords="186,164,364,190" href="#">
    <area shape="rect" alt="" coords="1,164,176,190" href="index.php">
    </map>
    <?php echo zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT, 'usemap=#logo_Map'); ?>
    
    </div>
    </div>
    any help with figuring this out would be greatly appreciated.

  8. #8
    Join Date
    Dec 2008
    Posts
    12
    Plugin Contributions
    0

    Default Re: ImageMap in the logo...?

    I found this thread VERY helpful. . .

    http://www.zen-cart.com/forum/showthread.php?t=80885

 

 

Similar Threads

  1. Making an imagemap or placing links to the right of the logo?
    By yelow in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 16 Oct 2008, 03:28 PM
  2. Logo ImageMap
    By DeniseF in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 4 Aug 2008, 03:00 AM
  3. No subcatecory links - use my imagemap
    By bbkidsdad in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 11 May 2008, 07:57 PM
  4. Imagemap in logo
    By bellagraysboutique in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 27 Oct 2007, 05:20 PM
  5. ImageMap Explanation
    By zero1niner in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 11 Apr 2007, 10:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg