@trendoman: Thanks a Ton!!!
This is the working code (explained):Owl Carousel has the following HTML structure
- Code: Select all
<div id="owl-demo">
<div class="item">
...
</div>
<div class="item">
...
</div>
<div class="item">
...
</div>
<div class="item">
...
</div>
</div>
In my case each <div class="item">...</div> was to be repeated. The challenge being, each alternate item had to bring in a page fetched by <cms:pages>...</cms:pages> for two different templates, "news.php" and "events.php".
As @trendoman suggested in the post above, the content of each clonable page (from news.phpa and events.php) was captured into a variable, with the <div class="item">...</div> defined, as:
- Code: Select all
<!-- Step 1 & 2 -->
<cms:pages masterpage='news.php' limit='4' >
<cms:capture into='page_content'>
<div class="item">
<div class="col-md-12 no-margin no-padding">
<div class="news-card-container">
<div class="news-card-image-header">
<cms:show_repeatable 'news_banner' >
<cms:if k_count le '1' >
<img src="<cms:show news_banner_images />" />
</cms:if>
</cms:show_repeatable>
</div>
<div class="news-card-body padding-10">
<h4><cms:excerptHTML count='3'><cms:show k_page_title /></cms:excerptHTML></h4>
<cms:if k_page_foldertitle>
<cms:set cat=k_page_foldertitle />
<cms:else />
<cms:set cat='General' />
</cms:if>
<p><small><cms:show cat /> | <cms:date k_page_date format='jS M, Y' /></small></p>
<cms:excerptHTML count='15'><cms:show news_desc /></cms:excerptHTML>
</div>
<div class="news-card-footer">
<a class="ripple button-name" href="<cms:show k_page_link />">Read More</a>
</div>
</div>
<div class="ptop-10"></div>
</div>
</div>
</cms:capture>
<cms:put var="news<cms:show k_current_record />" value=page_content scope='global' />
</cms:pages>
Same code for events.php clonable template with the tweaks
Each captured page was stored into a variable "owl" as:
- Code: Select all
<-- Step 3 -->
<cms:capture into='owl' >
<cms:repeat count='4' startcount='1' >
<cms:get "news<cms:show k_count />" />
<cms:get "event<cms:show k_count />" />
</cms:repeat>
</cms:capture>
And finally the variable "owl" was displayed:
- Code: Select all
<!-- Step 4 -->
<cms:show owl />
And viola!!! couch handled the output as was desired.
Once again, a million thanks to @KK sir for such a lovely retrofitting cms and a million thanks to my bro @trendoman for the logical solution that he put together in no time!!!
Hope this comes handy to other Couchies!!!