Jump to content

Edit History

kdash1228

kdash1228

17 minutes ago, musicmaster said:

If you study the code you see this line


{foreach from=$product.images item=image}

That is the line that defines $image and only within this loop is $image defined. It is the equivalent of PHP's foreach($product.images AS $image)

As your figcaption section is far above this loop $image means nothing there. 

Thank you!

I am not a PHP expert but I did put {foreach from=$product.images item=image} within the <figure> tag and was able to get the image caption to display, but I don't think I had it in the correct location.

I tried the following and it displayed all captions for the product, not just the select image. 

<figcaption class="image-caption">
{block name='product_description_short'}
{foreach $product.images AS $image}
<div id="product-description-short" itemprop="description">{$image.legend nofilter}</div>
{/foreach}
{/block}
 </figcaption>

What would be the correct way to define $image within the <figcaption> section since I don't want a loop?

kdash1228

kdash1228

5 minutes ago, musicmaster said:

If you study the code you see this line


{foreach from=$product.images item=image}

That is the line that defines $image and only within this loop is $image defined. It is the equivalent of PHP's foreach($product.images AS $image)

As your figcaption section is far above this loop $image means nothing there. 

Thank you!

I am not a PHP expert but I did put {foreach from=$product.images item=image} within the <figure> tag and was able to get the image caption to display, but I don't think I had it in the correct location.

What would be the correct way to define $image within the <figcaption> section?

×
×
  • Create New...