Velocity scripting is most common used language, that is used in some tools like adobe target emailers tool, so we need to apply som oprations in velocity scriptiing to show the item in frontend and the most common method is the itrations of list in velocity script
Lets suppose a senario where we need to display 6 items coming from beckend with the help of velocity scripting, so the method is as smilear to the what we do in most of the language to ittrate them in the loop and inside the loop we can also apply the htm tage to display on fronend nicely, you can try the below code to itrate them in a loop
<div class="product-list swiper-container swiper-container-horizontal swiper-container-free-mode swiper1"
data-products-in-view="4" style="cursor: grab;">
<div class="section-heading" data-cc-animate="">
<h2 class="h2 planet_title">Add recently viewed items to the cart</h2>
</div>
<div class="product-block-wrapper sbx-slick-rec">
#set($count=1)
#foreach($e in $entities)
#if( $count <= $entities.size() && $count <=4 && $e.id !="" ) <div
class="product-block cc-product-block on-sale cc-fade-in-up cc-animate-init cc-initialized -in cc-animate-complete"
data-loop-index="4" data-cc-animate="cc-fade-in-up" data-cc-animate-delay="0.24s" style="">
<div class="product-block__inner">
<div class="image ">
<a data-cc-animate-click="" class="image-inner" href="$e.pageUrl"
aria-label="$e.name" tabindex="-1">
<div class="image__first">
<div class="rimage-outer-wrapper" style="max-width: 1000px">
<div class="rimage-wrapper " style="padding-top:100.0%">
<img src="$e.thumbnailUrl" alt="$e.name" title="$e.name"
class="rimage__image">
<noscript>
<img src="$e.thumbnailUrl" alt="" class="rimage__image">
</noscript>
</div>
</div>
</div>
</a>
</div>
</div>
#set($count = $count + 1)
#end
#end
</div>
</div>
In the above code we have ittrated data in some slider where we delared a variable #set($count=1) which is a counter starts from 1 , after then we are calling a #foreach($e in $entities) method to itrate between the entities, it will itrate until #if( $count <= $entities.size() && $count <=4 && $e.id !=”” ) count is smaller then equal to 4
and through $e we can call the objects and there values to render on frontend.