Hi
I am trying to convert an existing component jsp to sightly html.
The jsp has the following code:
<script>
var MY_CAROUSEL_PARAMS_A = {
control: {
controls: ${properties.controlsType eq 'controls' ? 'true' : 'false'}
<c:if test="${properties.controlsType eq 'pager' || properties.controlsType eq 'both'}" >,
pager: {
center: ${properties.centerNav eq 'true' ? '1' : '0'},
buildPager: function(pageIndex){
var hoverImage = '';
var hoverText = '';
var hoverWidth = '';
switch(pageIndex){
<c:forEach var="slide" varStatus="loop" items="${carouselSlides}">
case ${loop.index}:
hoverImage = '${slide.value.tooltipImgPath}';
hoverText = '${slide.value.tooltipText}';
hoverWidth = '${slide.value.tooltipWidth}';
break;
</c:forEach>
}
}
}
</c:if> },
</script>
I am able to get most of the values using sightly inside the script tag.
But how do I implement the <c:if> or <c:foreach> tags in sightly inside a script tag for the above code in bold font.
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks edubey.
I could not find any help in the above documentation. However I followed a different approach and did some java code to get the loop working.
Views
Replies
Total Likes
Sightly provides similar for loop which can be used.
1. You can either use data-sly-list provided by sightly, Documentation
2.Or put you business logic for JSON in javascript use api file. You will have access to all data and api you need to generate json ( Should be easy to use and maintain but hard to debug) Article: http://adobeaemclub.com/javascript-use-api-with-a-simple-component-in-sightly/
Thanks
Views
Replies
Total Likes
Thanks edubey.
I could not find any help in the above documentation. However I followed a different approach and did some java code to get the loop working.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies