Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Created November 27, 2012 15:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stevewithington/4154782 to your computer and use it in GitHub Desktop.
Save stevewithington/4154782 to your computer and use it in GitHub Desktop.
Mura CMS: Bootstrap Carousel Example Using Local Content Index
<!--- 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">&lsaquo;</a>
<a class="right carousel-control" href="##myCarousel" data-slide="next">&rsaquo;</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 --->
@manking109
Copy link

I use the following code

<cfset feed=$.getBean('feed').loadBy(feedid='F09D4736-1B54-456D-B649BA39BB6AAAA5',siteid='My_site_1')>
            <cfset carouselIterator=feed.getIterator()>
            <cfif carouselIterator.hasNext()>

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment