Skip to content

Instantly share code, notes, and snippets.

View makbeta's full-sized avatar

makbeta makbeta

View GitHub Profile
@makbeta
makbeta / category-headings-list.html
Created November 30, 2012 02:05
Luminate CMS: How to render a list of CMS items with category heading? (this will work better once we will have an ability to sort lists by category)
<t:set id="lastcat" value="null" />
<t:list>
<t:list id="resource_type">
<t:if test="lastcat != name">${label}<t:set id="lastcat" value="name" /></t:if>
</t:list>
</t:list>
@makbeta
makbeta / random-item-list.html
Created November 30, 2012 02:06
Luminate CMS: A list that chooses one random item and displays the description field of the item.
<t:if test="length > 0">
<t:set id="randomOne" value="random(length)+1" />
<t:list>
<t:if test="index == randomOne">
<div class="blue">
<h4 class="fact">Did You Know...</h4>
<div class="content">${description}</div>
</div>
</t:if>
</t:list>
@makbeta
makbeta / zero-results-list.html
Created November 30, 2012 02:07
Luminate CMS: How to configure a list to display to show alternative text when filter criteria is not satisfied
<t:if test="length > 0">
<div class="list"><h3>My Heading</h3>
<t:list>
<div class="list-item"><a href="${url}">${title}</a></div>
<t:list>
</div>
</t:if>
<t:else>
<p>No results for your parameters</p>
</t:else>
@makbeta
makbeta / three-random-items-list.html
Created November 30, 2012 02:08
Luminate CMS: Display 3 random items from the list
<t:if test="length > 0"><!-- is there a list? -->
<t:set id="iRandom" value="random(length)+1" /><!-- set a variable equal to a number between 1 and the length of the list -->
<!-- if random number is within 2 of the last item in the list, subtract 2 -->
<t:if test="iRandom >= (length-2) && iRandom <= length">
<t:set id="iRandom" value="iRandom-2" />
</t:if>
<!-- if the variable is now negative due to the subtraction above, reset it to 1 (the first list item) -->
<t:if test="iRandom <= 0">
@makbeta
makbeta / custom-filter-criteria.html
Created November 30, 2012 02:10
Luminate CMS: Custom filter criteria component
<form action="/blog/" class="topics-filter" >
<select name="topics">
<option value="">Filter by Issue</option>
<t:data name="issue" class="categories" parent="/topics" />
<t:list id="issue">
<t:if test="param.topics == name">
<option value="${name}" selected="selected">${label}</option>
</t:if>
<t:else>
<option value="${name}">${label}</option>
@makbeta
makbeta / reading-a-cookie.html
Created November 30, 2012 02:11
Luminate CMS: Reading a cookie server-side
@makbeta
makbeta / conditional-breadcrumbs.html
Created November 30, 2012 02:13
Luminate CMS: Customize breadcrumbs to not render current page on index pages
<t:if test="matches(path, '.*/')">
<t:include id="breadcrumb-XXXXXXXX" />
</t:if>
<t:else>
<t:include id="breadcrumb-xxxxxxxx" />
</t:else>
@makbeta
makbeta / shorten-body.html
Created November 30, 2012 02:14
Luminate CMS: Display first 256 characters of the body/blurb
<t:set id="strippedbody" value="toText(body, '')" />
<t:set id="blurb" value="substring(strippedbody, 0, 256) " />
<div class="blurb"><t:value id="blurb"/></div>
@makbeta
makbeta / reading-rss2-via-incomingRSS.html
Created November 30, 2012 02:15
Luminate CMS: How to display standard RSS 2.0 feed as a bullet list via Incoming RSS component?
<ul class="list">
<t:list id="rss.channel.item" maxlength="5">
<li><a href="${link}" target="_blank">${title}</a></li>
</t:list>
</ul>
@makbeta
makbeta / template-switch.html
Created November 30, 2012 02:16
Luminate CMS: Dynamically switch single display template
<a href="${url}?templateName=template-35423733">${title}</a>