Skip to content

Instantly share code, notes, and snippets.

View makbeta's full-sized avatar

makbeta makbeta

View GitHub Profile
@makbeta
makbeta / image-sharing.html
Created November 30, 2012 01:55
Luminate CMS: Image Sharing between CMS & CLO
<img src="[[?x0x::x[[S4]]x::http://www.myclodomain.com/images/wrpr/::../images/wrpr/]]logo.png" alt="My Organization" />
@makbeta
makbeta / search-stf-pages-conditional.html
Created November 30, 2012 01:56
Luminate CMS: How do I render content in the wrapper on search or send to friend pages only?
<t:if test="title == 'Search Results' || matches(title, 'Send to Friend:.*')">
<div id="maincol"><h1 class="title">${title}</h1>
</t:if>
<div class="templateComponent" id="body"></div>
<t:if test="title == 'Search Results' || matches(title, 'Send to Friend:.*')">
</div>
</t:if>
@makbeta
makbeta / todays-date.html
Last active October 13, 2015 09:17
Luminate CMS: Displaying the current date
<t:set id="today" value="days(0)" />
<p>Today is ${today}.</p>
<p>Today is <t:value id="today" type="date" format="EEEE, MMM d yyyy">Jan 1, 2005</t:value>.</p>
@makbeta
makbeta / start-end-date.html
Created November 30, 2012 01:57
Luminate CMS: Displaying a date range (start to end date) with proper formatting
<t:if test="year(start_date) != year(end_date)"><t:value id="start_date" format="5" /> - <t:value id="end_date" format="5" /></t:if>
<t:else>
<t:if test="month(start_date) == month(end_date)"><t:value id="start_date" format="MMMMMMMMMM d" /> - <t:value id="end_date" format="d, yyyy" /></t:if>
<t:else><t:value id="start_date" format="MMMMMMMMMM d" /> - <t:value id="end_date" format="5" /></t:else>
</t:else>
</t:if>
@makbeta
makbeta / date-as-attribute.html
Created November 30, 2012 01:58
Luminate CMS: How to display a date field in yyyy-mm-dd format as an attribute of an html tag
<t:set id="pdate" value="year(date)" /><t:set id="pdate" value="concat(pdate, '-')" /><t:set id="temp1" value="month(date)+1" />
<t:set id="pdate" value="concat(pdate, temp1)" /><t:set id="pdate" value="concat(pdate, '-')" />
<t:set id="temp2" value="day(date)" /><t:set id="pdate" value="concat(pdate, temp2)" />
<time datetime="${pdate}"><t:value id="date" format="5" /></time>
@makbeta
makbeta / category-list.html
Created November 30, 2012 01:59
Luminate CMS: How to render a category (as a comma separated list) in a single display template:
<t:if test="category-field-name.length > 0">
<t:list id="category-field-name">
<a href="list-page.html?category-field-name=${name}">${label}</a><t:if test="index != length">,</t:if>
</t:list>
</t:if>
@makbeta
makbeta / related-image-display.html
Created November 30, 2012 01:59
Luminate CMS: How to render and style related image in a single display template
@makbeta
makbeta / fist-last-classes-list.html
Created November 30, 2012 02:01
Luminate CMS: Assign classes .first & .last to first & last items in the list
<t:if test="length > 0">
<ul><t:list>
<t:set id="myClass" value="''" />
<t:if test="index == 1"><t:set id="myClass" value="'first'" /></t:if>
<t:if test="index == length"><t:set id="myClass" value="concat(myClass, ' last')" /></t:if>
<t:set id="myClass" value="trim(myClass)" />
<t:if test="!isNull(myClass)"><li class="${myClass}"></t:if>
<t:else><li></t:else>
<a href="${url}">${title}</a><p>${description}</p>
</li>
@makbeta
makbeta / striped-list-table.html
Created November 30, 2012 02:02
Luminate CMS: How to make a striped list or table?
<style>
div.odd { background: #eee; }
div.even { background: #fff; }
</style>
<div class="striped">
<t:list>
<t:if test="index%2 == 1"><div class="odd"></t:if>
<t:else><div class="even"></t:else>
${title}
@makbeta
makbeta / grouped-by-date.html
Created November 30, 2012 02:03
Luminate CMS: How to render a list of CMS items with a date field grouped by month?
<t:if test="length > 0">
<t:set id="lastdate" value="''" />
<t:list>
<t:if test="month(date) != lastdate"><h3><t:value id="date" format="MMMMMMMMM" /></h3></t:if>
<a href="${url}">${title}</a>
...
<t:set id="lastdate" value="month(date)" />
</t:list>
</t:if>