Skip to content

Instantly share code, notes, and snippets.

<section>
<h2>Mura CMS</h2>
<cffeed query="rs" source="http://www.getmura.com/tasks/feed/?feedID=91B4E7A5-37AC-466A-ACDF6ABFD95ACCBD" />
<cfset it = $.getBean('beanIterator').setQuery(rs) />
<ul>
<cfif it.hasNext()>
<cfloop condition="it.hasNext()">
<cfset item = it.next()>
<li>
<a href="#item.getValue('rsslink')#">
<!--- drop this file under the theme's display_objects directory --->
<cfoutput>
<form id="login" class="form-horizontal" name="frmLogin" method="post" action="?nocache=1" onsubmit="return validate(this);" novalidate="novalidate" >
<legend>#arguments.$.rbKey('user.pleaselogin')#</legend>
<div class="control-group">
<label class="control-label required" for="txtPassword">#arguments.$.rbKey('user.password')#</label>
<div class="controls">
<input type="password" id="txtPassword" name="password" placeholder="#arguments.$.rbKey('user.password')#" required="true" message="#htmlEditFormat(arguments.$.rbKey('user.passwordrequired'))#" />
<span class="help-inline">#htmlEditFormat($.rbKey('user.required'))#</span>
</div>
<cfscript>
rsChildTags = $.getBean('contentGateway').getTagCloud(
siteid = $.event('siteid')
, parentid = $.content('contentid')
, categoryid = $.event('categoryid')
, taggroup = '' // could narrow down to a specific tag group as of 6.1
);
WriteDump(var=rsChildTags, label='rsChildTags');
<cfscript>
// Save this file to a path such as /{SiteID}/includes/remote/ajaxData.cfm
// This allows you to pass in the siteid and contentid via URL params
param name='url.siteid' default='default';
param name='url.contentid' default='00000000000000000000000000000000001';
// Mura $cope
$ = application.serviceFactory.getBean('$').init(url.siteid);
// Just in case we need access to the ContentBean
cBean = $.getBean('content').loadBy(contentid=url.contentid);
$.setContentBean(cBean);
<cfscript>
// Drop this in your Site or Theme eventHandler.cfc
public any function onBeforeFormSubmitSave($) {
// reference to the formBean
var formBean = arguments.$.event('formBean');
// example on how to create some errors
var error = '';
var errors = {};
<cfscript>
// drop this in your eventHandler.cfc
public any function yourMethod() {
// you do something here
}
public any function onApplicationLoad($) {
arguments.$.getBean('someBean').injectMethod('someMethod', yourMethod);
}
component extends='mura.cfobject' {
// drop this in your site or theme eventHandler.cfc
public any function onRenderStart($) {
// allow for a 'View As PDF' link (e.g., <a href="./?viewAsPDF=1">View As PDF</a>)
if ( IsBoolean(arguments.$.event('viewAsPDF')) && arguments.$.event('viewAsPDF') ) {
arguments.$.content('template', 'pdf.cfm');
}
<!--- Drop this into your site eventhandler.cfc --->
<cffunction name="onAfterFormSubmitSave" output="true">
<cfif $.event('formid') EQ '{ID of the Mura form}'>
<!--- Get the form result --->
<cfset formBean = $.event().getValue('formresult')>
<!--- Get a new content bean --->
<cfset cBean = application.contentManager.getBean()>
<!--- Set the new node attributes --->
<cfset cBean.setSiteID($.event('siteid'))>
@ronnieduke
ronnieduke / mura-single-page.cfm
Created April 12, 2014 20:25
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>
@ronnieduke
ronnieduke / mura-multi-level-main-nav.cfm
Created April 30, 2014 21:39
This trick comes in handy if you want to use Mura's Multi-Level Nav to power the navigation for your entire site (as opposed to dspPrimaryNav() ). Helpful if you want to use Mura to create a Documentation site for example with many nested levels in the sidebar.
<!--- Add this to any page template or include --->
<!--- By setting the contentID=00000000000000000000000000000000001, Mura will allow top level pages to render in the nav. --->
<nav id="navMultilevel" class="mura-nav-standard sidebar-nav well">
#$.dspNestedNav(
contentID='00000000000000000000000000000000001',
viewDepth=4,
currDepth=1,
sortBy='orderno',
sortDirection='asc',
subNavExpression="listFindNoCase('Page,Calendar',rsSection.type) and listFind($.content('path'),rsSection.contentID) and arguments.currDepth lt arguments.viewDepth"