Skip to content

Instantly share code, notes, and snippets.

@ronnieduke
Created April 12, 2014 20:25
Show Gist options
  • Save ronnieduke/10555093 to your computer and use it in GitHub Desktop.
Save ronnieduke/10555093 to your computer and use it in GitHub Desktop.
Display a single page site using the Mura Iterator. This is in context of a parallax theme that needed multiple dom elements of the same content.
<cfoutput>
<cfinclude template="inc/html_head.cfm" />
<!--- By getting a feed with a blank value, Mura will return all pages underneith the homepage --->
<cfset feed=$.getBean("content").loadBy(filename='',siteID=$.event("siteid"))>
<cfset iterator=feed.getKidsIterator()>
<cfif iterator.hasNext()>
<body id="home">
<!--- add the "home" page statically --->
<div class="scroll-holder" data-stub="###$.createCSSid($.content('menuTitle'))#-stub" data-image="#$.content().getImageURL('source')#" data-speed="#$.content('pDataSpeed')#"></div>
<!--- Create the scroll holders for each additional "page" on your page --->
<cfloop condition="iterator.hasNext()">
<cfset item=iterator.next()>
<div class="scroll-holder" data-stub="###$.createCSSid(item.getMenuTitle())#-stub" data-image="#item.getImageURL('source')#" data-speed="#item.getpDataSpeed()#"></div>
</cfloop>
<!--- this resets the iterator back to zero so we can loop through our content again --->
<cfset iterator.reset()>
<!--- this creates the header and navigation --->
<header id="header" role="banner">
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<h1 id="logo">#HTMLEditFormat($.siteConfig('site'))#</h1>
<div class="nav-collapse collapse">
<nav id="nav" role="navigation">
<ul>
<li><a href="###$.createCSSid($.content('menuTitle'))#">#$.content('menuTitle')#</a></li>
<cfloop condition="iterator.hasNext()">
<cfset item=iterator.next()>
<li><a href="###$.createCSSid(item.getMenuTitle())#">#item.getMenuTitle()#</a></li>
</cfloop>
</ul>
</nav>
</div>
</div>
</div>
</div>
</header>
<!--- resetting again --->
<cfset iterator.reset()>
<!--- Create the home section statically --->
<section role="main" id="#$.createCSSid($.content('menuTitle'))#" data-type="page">
<div data-scroller="#$.createCSSid($.content('menuTitle'))#" id="#$.createCSSid($.content('menuTitle'))#-stub" class="stub"></div>
<div class="container-fluid page">
#$.dspBody(body=$.content('body'),pageTitle='',crumbList=0,showMetaImage=0)#
</div>
</section>
<!--- Loop through the additional pages --->
<cfloop condition="iterator.hasNext()">
<cfset item=iterator.next()>
<section role="main" id="#$.createCSSid(item.getMenuTitle())#" data-type="page">
<div data-scroller="#$.createCSSid(item.getMenuTitle())#" id="#$.createCSSid(item.getMenuTitle())#-stub" class="stub"></div>
<div class="container-fluid page">
<!--- If the content is a folder, we want to display that a little differently with the folder and it's children --->
<!--- Obviously this can be extended to account for different nodes such as 'Calendar', 'Gallery' etc --->
<cfif item.getType() eq "Folder">
<cfset folderID=item.getContentID()>
<cfset iterator=$.getBean("content").loadBy(contentid='#folderID#').getKidsIterator()>
<cfif iterator.hasNext()>
<div class="row-fluid">
<!--- loop through the folder's children --->
<cfloop condition="iterator.hasNext()">
<cfset item=iterator.next()>
<div class="span4">
<img src="#item.getImageURL()#" alt="#item.getTitle()#">
<h4>#item.getTitle()#</h4>
<h4>
<i class="icon-twitter"></i>
<i class="icon-facebook"></i>
<i class="icon-linkedin"></i>
<i class="icon-github"></i>
</h4>
#item.getSummary()#
</div>
</cfloop>
</div>
</cfif>
<!--- if it's not a folder, just display the body as normal --->
<cfelse>
#$.dspBody(body=item.getBody(),pageTitle='',crumbList=0,showMetaImage=0)#
</cfif>
</div>
</section>
</cfloop>
<cfinclude template="inc/footer.cfm" />
<cfinclude template="inc/html_foot.cfm" />
</body>
</cfif>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment