Velocity Coding Example - Display template based on parameter
Introduction
This tutorial shows how to use Velocity code within your catalog to change the template being used based on a parameter set on the URL.
Sample Code
#if ($parameters.get("view") == "quick") #ucTemplate("template_item_quick") #else #ucTemplate("template_item_full") #end
Link
<a href="${columnUrl}?view=quick”>
Break Down
Condition
#if ($parameters.get("view") == "quick") #ucTemplate("template_item_quick") #else
Here we are looking thought the link and if the value for "view" is "quick then we display the template below. If there is not value for "view" or the parameter does not exist then we use the following:
Second condition
#ucTemplate("template_item_full") #end
This will display the "template_item_full" if there is not value for "view" or it is not equal to "quick"
This can be used in a number of different way, including having more then 1 item template for you catalog so that some item can display with a different design or within an iframe or popup.