Alt Image Tag

General ShopSite user discussion

Alt Image Tag

Postby extragear » Mon Aug 19, 2013 11:50 am

Greetings:

I'm trying to get alt tags as part of our page templates. On our current page template we have the following for any thumbnail that is displayed:

*******************************
[-- END_DEFINE PAGE --]

[-- DEFINE LINK_TO_PAGE --]
[-- IF VAR.linkFormat "dropdown" --]
<li><a href="[-- OUTPUT_DIRECTORY_URL --]/[-- Page.Filename --]">
[-- IF Page.LinkGraphic --]
<?PHP

$linkGraphic = <<<LINKGRAPHIC
[-- Page.LinkGraphic --]

LINKGRAPHIC;

preg_match('/media\/(.+?\.\w{1,3})/sim',$linkGraphic,$linkGraphicMatch);

?>
<img src="media/phpThumb.php?src=<?PHP echo $linkGraphicMatch[1]; ?>&h=35" height="35" border="0">
[-- END_IF --]
<p>[-- IF Page.LinkName --][-- Page.LinkName REMOVE_HTML --][-- ELSE --][-- Page.Name REMOVE_HTML --][-- END_IF --]</p>
</a></li>
[-- ELSE_IF VAR.linkFormat "standard" --]
<div class="pageLink<?PHP echo ( $counter == 3 ) ? " last" : ""; ?>">
[-- IF Page.LinkGraphic --]
<?PHP

$linkGraphic = <<<LINKGRAPHIC
[-- Page.LinkGraphic --]

LINKGRAPHIC;

preg_match('/media\/(.+?\.\w{1,3})/sim',$linkGraphic,$linkGraphicMatch);

?>
<a href="[-- OUTPUT_DIRECTORY_URL --]/[-- Page.Filename --]"><img src="media/phpThumb.php?src=<?PHP echo $linkGraphicMatch[1]; ?>&w=100" width="100" border="0"></a><br>
[-- END_IF --]
<a href="[-- OUTPUT_DIRECTORY_URL --]/[-- Page.Filename --]">[-- IF Page.LinkName --][-- Page.LinkName REMOVE_HTML --][-- ELSE --][-- Page.Name REMOVE_HTML --][-- END_IF --]</a>
</div>
[-- END_IF --]
[-- END_DEFINE LINK_TO_PAGE --]

*******************************

I've tried replacing,

<img src="media/phpThumb.php?src=<?PHP echo $linkGraphicMatch[1]; ?>&h=35" height="35" border="0">

with

<img src="media/phpThumb.php?src=<?PHP echo $linkGraphicMatch[1]; ?>&h=35" height="35" border="0" alt="[-- IF Page.LinkName --][-- Page.LinkName REMOVE_HTML --][-- ELSE --][-- Page.Name REMOVE_HTML --][-- END_IF --]">

and

modifying this


<a href="[-- OUTPUT_DIRECTORY_URL --]/[-- Page.Filename --]"><img src="media/phpThumb.php?src=<?PHP echo $linkGraphicMatch[1]; ?>&w=100" width="100" border="0"></a><br>

to

<a href="[-- OUTPUT_DIRECTORY_URL --]/[-- Page.Filename --]"><img src="media/phpThumb.php?src=<?PHP echo $linkGraphicMatch[1]; ?>&w=100" width="100" border="0" alt="[-- IF Page.LinkName --][-- Page.LinkName REMOVE_HTML --][-- ELSE --][-- Page.Name REMOVE_HTML --][-- END_IF --] ></a><br>

Neither of which produced alt tag output on the published page. Note, I double checked to make sure the link page name field was populated.

Note, this is a custom template that purchased. Any assistance is appreciated.

Thanks

Tim
extragear
 
Posts: 169
Joined: Mon Apr 02, 2007 10:53 am
Location: Binghamton, NY

Re: Alt Image Tag

Postby Jim » Mon Aug 19, 2013 12:32 pm

I don't know what all the php stuff is suppose to do but that isn't code that ShopSite would be providing since it is not custom template language code.

All alt tags are defined in ShopSite on the Images > select image > Edit Images screen.

What is actually used to display images when using the custom template image tags is contained in a file named .img.<image name>. For example if I have an image named logo.gif the file is called .img.logo.gif. Here is the content of that file from my system.
Code: Select all
hspace_0: 3
other_0:
hspace_1: 3
other_1:
height_0: 79
hspace_2: 3
other_2:
height_1: 79
hspace_3: 3
other_3:
height_2: 45
vspace_0: 3
height_3: 24
vspace_1: 3
vspace_2: 3
vspace_3: 3
url_0: http://mydomain.com/11sp3/html/jimsp3/media/logo.jpg
url_1: http://mydomain.com/11sp3/html/jimsp3/media/ss_size1/logo.jpg
url_2: http://mydomain.com/11sp3/html/jimsp3/media/ss_size2/logo.jpg
alt_0:
url_3: http://mydomain.com/11sp3/html/jimsp3/media/ss_size3/logo.jpg
alt_1:
alt_2:
alt_3:
border_0: 0
border_1: 0
width_0: 259
border_2: 0
width_1: 259
border_3: 0
width_2: 149
width_3: 79
As you might notice there are 4 of each field for border, width, height, alt etc. The 0 value is for the original image 1,2,3 are for the resized images. When you use a tag like [-- product.graphic --] in a template, at publish time the .img file is read to determine what the appropriate url value along with the corresponding border, width, height, alt etc are combined to give the complete url that is placed in the html page for that image. This uses the image size field configured for that particular image type, (product image, Moreinfo image, shopping cart product image etc)

If you want to use just part of the image tag information there is a tag [-- IMAGE PRODUCT.Graphic --] that will just give the media subdirectory and file name of the product graphic without the domain name or attributes (height, width, alt tag etc.). Using this you can then construct your complete image html code by adding the domain name and what ever attributes you want.

I don't know if that will help you but since I don't have a clue about the php stuff it is the best I can offer.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Alt Image Tag

Postby extragear » Tue Aug 20, 2013 6:47 am

Jim

Thanks for that info. I will experiment with it.

Tim
extragear
 
Posts: 169
Joined: Mon Apr 02, 2007 10:53 am
Location: Binghamton, NY


Return to User Forum

Who is online

Users browsing this forum: No registered users and 77 guests

cron