I'm new here

Is there any way to come out of the $CMS_FOR()$ tag ??


In my project, I have Set and List in the template and I need to compare the Set's value with the List's value. So I am using

$CMS_FOR$ to do the iterate the Set and then compare each vale with the List. If I find any Match I should come out of the

loop (there is no need to continue the loop). But I don't how to come out of the CMS_FOR tag.

Please let me know how to jump out of the loop or if there is any way to achieve this.

Thanks in Advance !!!!



0 Kudos
2 Replies
Community Manager

Hi Vasanth,

it's not possible in the current version, but it will be available with FirstSpirit5.

Here's the feature request (german only):Möglichkeit CMS_FOR-Anweisung zu verlassen

I'm new here

Hi vasanth,

Yes it's not possible in the current version, but you can use  $CMS_SET(count,"1")$ and some condtions in side the for loop to reach your scenario.

Please see the example code, here i need to show latest 2 articles from all article categories and region based. I used link templates for the region , so i can't able to filter using query. So, i used this scenario...

I hope it help for you.......



     $CMS_FOR(for_link, alist.display_ref)$       

       $CMS_IF((for_link.text).equals(region.toString) && !(count).equals("2"))$               

          <table cellspacing="0" cellpadding="0" border="0" class="news-item">



             <div class="news-item-date">

              <div class="news-arrow"><!-- Managed from css --></div>

              <div class="news-day">$CMS_VALUE(alist.publish_date.format("dd"))$</div>

              <div class="news-month">$CMS_VALUE(alist.publish_date.format("EEE"))$</div>

              <div class="news-year">$CMS_VALUE(alist.publish_date.format("yyyy"))$</div>



            <td width="100%">



                          $-- Preview--$

                          <a href="$CMS_REF(for_link.lt_referenace,$"> $CMS_VALUE(alist.title)$ </a>       


                          $-- Portal --$                                                                                                      

                          <a href=$CMS_RENDER(template:"portal_navigation", targetUid:ref(for_link.lt_referenace,, targetUrl:ref(for_link.lt_referenace,abs:1,, linkContent:set_linkContent,$> $CMS_VALUE(alist.title)$ </a>













0 Kudos