Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

This tutorial shows how to use velocity code and conditional statements within your catalog templates to display an items multimedia.  This velocity code example is intended to be used with the catalog templates:

...

Here we have looped through the item to see if there are any multimedia files with the code "image". If the condition is true the following code is output:

Code Block
themeDJango
titleStatement One
                 <a href="$item.getDefaultMultimedia('Image').getViewUrl()" title="$item.getDescription()">
                   <img src="$baseThumbnailUrl$item.getDefaultMultimedia('Image').getThumbnail(240)" alt="$item.getDescription()" width="240" height="240"  />
                 </a>

...

If there is no multimedia uploaded to the item with the code "Image" then the #else condition is true and the following code is output:

Code Block
themeDJango
titleStatement two
<img src="default.jpg" alt="Image coming soon"/>

...