Skip to content

Instantly share code, notes, and snippets.

View stevewithington's full-sized avatar
⛑️
solving problems

steve withington stevewithington

⛑️
solving problems
View GitHub Profile
<cfscript>
/**
*
* This file is part of MuraLocations TM
* (c) Stephen J. Withington, Jr. | www.stephenwithington.com
*
* CAREFULLY READ THE ENCLOSED LICENSE AGREEMENT (plugin/license.htm). BY USING THIS SOFTWARE,
* YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT. IF YOU DO NOT
* AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, THEN DO NOT USE THIS SOFTWARE, AND, IF APPLICABLE,
* RETURN THIS PRODUCT TO THE PLACE OF PURCHASE FOR A FULL REFUND.
@stevewithington
stevewithington / dsp_custom_search.cfm
Last active March 19, 2021 16:25
Mura CMS: Custom Search Example
<cfoutput>
<div>
<form action="#$.content('url')#?keywords=#$.event('keywords')#">
<dl>
<dt>Keywords</dt>
<dd><input type="text" name="keywords" value="#HTMLEditFormat($.event('keywords'))#" /></dd>
<dd><input type="submit" value="Search" /></dd>
</dl>
@stevewithington
stevewithington / dsp_custom_nav.cfm
Created October 10, 2012 17:41
Mura CMS: Simple Iterator Example
<!--- Uber simple Mura CMS Iterator --->
<cfscript>
feed=$.getBean("feed").loadBy(name="Local Index 'Name' Goes Here");
iterator=feed.getIterator();
</cfscript>
<cfif iterator.hasNext()>
<cfoutput>
@stevewithington
stevewithington / muraBootstrapCarousel.cfm
Created November 27, 2012 15:24
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()>
@stevewithington
stevewithington / muraCategoryIteratorExamples.cfm
Created November 29, 2012 18:13
Mura CMS: Category Iterator Examples
<cfscript>
// Category Iterator of Children of the Current Content Node
itKidsCats = $.content().getKidsCategoryIterator();
// Category Iterator of the CURRENT Content Node
itCats = $.content().getCategoriesIterator();
</cfscript>
<cfoutput>
<!--- Children of the Current Content Node --->
<h4>Kids Categories</h4>
<cfif itKidsCats.hasNext()>
@stevewithington
stevewithington / VirtualBox-Guest-Additions.sh
Created December 18, 2012 13:49
Installing VirtualBox Guest Additions From Terminal
VBOX_VERSION=4.2.4
cd /tmp
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
mount -o loop,ro VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
#rm VBoxGuestAdditions_$VBOX_VERSION.iso
unset VBOX_VERSION
@stevewithington
stevewithington / muraRandomRelatedContent.cfm
Last active September 11, 2020 11:20
Mura CMS: a "Related Content" iterator and query/recordset sorted randomly
<cfscript>
listSortBy = 'menutitle,title,lastupdate,releasedate,orderno,displaystart,displaystop,created,credits,type,subtype';
listSortDir = 'asc,desc';
sortby = ListGetAt(listSortBy, RandRange(1, ListLen(listSortBy), 'SHA1PRNG'));
sortdir = ListGetAt(listSortDir, RandRange(1, ListLen(listSortDir), 'SHA1PRNG'));
rsRelated = $.content().getRelatedContentQuery(sortby=sortby, sortDirection=sortdir);
itRelated = $.getBean('contentIterator').setQuery(rsRelated);
</cfscript>
<!---
@stevewithington
stevewithington / dropSlatwallDBTables.sql
Created January 7, 2013 19:58
SQL Server Script to delete all FK in the DB and drop any table that starts with XXX
DECLARE @sqlForeignKeys VARCHAR(MAX)
SELECT @sqlForeignKeys = ISNULL(@sqlForeignKeys,'') +
'ALTER TABLE dbo.[' + OBJECT_NAME(FK.parent_object_id) + '] DROP CONSTRAINT [' + FK.name + '];' + CHAR(10)
FROM SYS.FOREIGN_KEYS FK
//PRINT(@sqlForeignKeys)
EXEC(@sqlForeignKeys)
@stevewithington
stevewithington / usernameNotRequired.cfm
Created January 11, 2013 16:30
Mura CMS: How to use the user's email address as the username. This would make it unnecessary to collect the username on the form itself.
<cfscript>
// place this in the theme's eventHandler.cfc and reload the application
public any function onBeforeUserSave(struct $) output=false {
var user = arguments.$.event('userBean');
user.setUsername(user.getEmail());
// you could also add custom errors like so
var hasError = false;
// then do some validation of input
// .. validation would go here ..
<cfscript>
//Get current content's category assignments
rsCategories=$.content().getCategoriesQuery();
//Build a feed of images with matching categories
images=$.getBean("feed")
.setCategoryID( valueList(rsCategories.categoryID) )
.addParam(field='tcontent.type',condition="EQ",criteria='File')
.addParam(field='tfiles.fileEXT',condition="in",criteria='jpg,png,gif,jpeg')
.getIterator();