Created
November 27, 2012 15:24
-
-
Save stevewithington/4154782 to your computer and use it in GitHub Desktop.
Mura CMS: Bootstrap Carousel Example Using Local Content Index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- BEGIN: Bootstrap Carousel ---> | |
<cfset feed=$.getBean('feed').loadBy(name='Your FeedName Goes Here')> | |
<cfset iterator=feed.getIterator()> | |
<cfif iterator.hasNext()> | |
<div id="myCarousel" class="carousel slide"> | |
<!--- Carousel items ---> | |
<div class="carousel-inner"> | |
<cfset idx = 0> | |
<cfloop condition="iterator.hasNext()"> | |
<cfset item=iterator.next()> | |
<cfif listFindNoCase('jpg,jpeg,gif,png', ListLast(item.getImageURL(), '.'))> | |
<cfset idx++> | |
<div class="item<cfif idx eq 1> active</cfif>"> | |
<img src="#item.getImageURL(width=1200,height=500)#" alt="#HTMLEditFormat(item.getTitle())#"> | |
<div class="carousel-caption"> | |
<h4><a href="#item.getURL()#">#HTMLEditFormat(item.getTitle())#</a></h4> | |
#item.getSummary()# | |
</div> | |
</div> | |
</cfif> | |
</cfloop> | |
</div> | |
<cfif idx> | |
<!--- Carousel nav ---> | |
<cfif idx gt 1> | |
<a class="left carousel-control" href="##myCarousel" data-slide="prev">‹</a> | |
<a class="right carousel-control" href="##myCarousel" data-slide="next">›</a> | |
</cfif> | |
<cfelse> | |
<div class="alert alert-info alert-block"> | |
<button type="button" class="close" data-dismiss="alert">x</button> | |
<h4>Oh snap!</h4> | |
Your feed has no items <em>with images</em>. | |
</div> | |
</cfif> | |
</div> | |
<cfelse> | |
<div class="alert alert-info alert-block"> | |
<button type="button" class="close" data-dismiss="alert">x</button> | |
<h4>Heads up!</h4> | |
Your feed has no items. | |
</div> | |
</cfif> | |
<!--- // END: Bootstrap Carousel ---> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use the following code
As long as I use this to see the feed on MY_site_1 it works fine. I use picture from feed to drive a carousel
If I want to use this feed on MY_Site_2 on the same mura instance it will not pull the feed? (I want to share the carousel from one site to another)
What am I doing wrong?