Forums / Setup & design / ImageMap as custom class with related objects

ImageMap as custom class with related objects

Author Message

Dustin Machi

Wednesday 14 April 2004 11:44:29 pm

I created a couple of new classes, one called imagemap and the other called mapareas. In the imagemap class I created a few fields for things like names and the image itself, then I added a "object relation list" which I can add mapareas to the object. Ultimately I include this object in an article or whatever, therefor I have created a custom template for /content/view/embed.tpl I got this new template working to display the image, however I cannot figure out despite having read a thousand somewhat related messages in this forum how to go through the object relation list and create the actual map area lines I need.

Here is an example of the template. The first part is just a standard template for viewing the image instead of a link to the image that I also figured out by reading this site. The last part however, where I actually build the <map></map> part doesn't work as I can't go through the list. Any suggestions would be <b>extremely</b> helpful...beside saving my sanity somewhat, it will also greatly assist in keeping me from getting further behind at work.

{let image_variation="false"
align="center"}
{set image_variation=$object.data_map.map_image.content["original"]}
{set align="center"}


{switch match=$align}

{case match="left"}
<div class="imageleft">
<img src={$image_variation.full_path|ezroot} /USEMAP="{$object.name|wash}">
</div>
{/case}

{case match="right"}
<div class="imageright">
<img src={$image_variation.full_path|ezroot} USEMAP="{$object.name|wash}"/>
</div>
{/case}

{case}
<div class="imagecenter">
<img src={$image_variation.full_path|ezroot} USEMAP="{$object.name|wash}"/>
</div>
{/case}
{/switch}

<MAP NAME="{$object.name|wash}">
    {section name=rel loop=$object.map_coordinates}

<area shape='rect' coords='0,178,123,202' href='participants.php?link=link7' title='Participants' alt='Participants' >
       <area shape='rect' coords='{$rel:item.data_map.origin_x},{$rel:item.data_map.origin_y},{$rel:item.data_map.end_x},{$rel:item.data_map.end_y}' href='{$rel:item.data_map.url|EzURL}' alt='{$rel:item.data_map.name}' />
    {/section}
</MAP>
{/let}

When I do this the only thing that ends up showing up in the page sources

   <MAP NAME="Image maps name">
   </MAP>

Thanks for any help.