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
@stevewithington
stevewithington / mobile-body.cfm
Last active April 27, 2018 19:10
Mura CMS: Display mobile body vs. regular body content
<!---
Use to display mobile specific content (assumes you have an attribute called 'mobilebody')
--->
<cfset mybody = request.muramobilerequest == 1
&& YesNoFormat(m.content('hasmobilebody'))
&& Len(m.content('mobilebody'))
? m.content('mobilebody')
: m.content('body') />
@stevewithington
stevewithington / config.xml.cfm
Last active September 17, 2020 10:26
Mura CMS v7: Sample YouTube Display Object
<displayobject name="YouTube Video" contenttypes="*"/>
@stevewithington
stevewithington / muraRebuildImageCache.cfm
Created April 25, 2016 14:30
Mura CMS: Rebuild image cache or re-save images on redefined image sizes
<!--- Force Image Resave for All Images --->
<cfset application.serviceFactory.getBean('fileManager').rebuildImageCache(siteid='YOURSITEID')>
<!--- or to just reset a specific image size you can use --->
<cfset application.serviceFactory.getBean('fileManager').rebuildImageCache(siteid='YOURSITEID' ,size='YOURSIZE')>
@stevewithington
stevewithington / sql-if-else-case.sql
Created November 25, 2015 21:43
SQL: When you need a if / else / then in your WHERE clause, this might help ...
SET @someVar = 'someValue';
SELECT *
FROM t_sometable
WHERE CASE @someVar <> '' THEN someColumn = @someVar ELSE someColumn = '' END;
@stevewithington
stevewithington / config.xml.cfm
Last active November 4, 2015 22:07
Mura CMS: Example of how to show a different body region for mobile users.
<?xml version="1.0" encoding="UTF-8"?>
<mura>
<extensions>
<extension adminonly="0" availablesubtypes="" basekeyfield="contentHistID" basetable="tcontent" datatable="tclassextenddata" description="" hasassocfile="1" hasbody="1" hasconfigurator="0" hassummary="1" iconclass="" subtype="Default" type="Base">
<attributeset categoryid="" container="Basic" name="Mobile Options" orderno="1">
<attribute adminonly="0" defaultvalue="" hint="" label="Mobile Body" message="" name="mobileBody" optionlabellist="" optionlist="" orderno="1" regex="" required="false" type="HTMLEditor" validation=""/>
</attributeset>
</extension>
</extensions>
</mura>
@stevewithington
stevewithington / mura-auto-updater.cfm
Created September 24, 2015 03:38
Mura CMS: How the Auto Updater works
<cfoutput>
<cfscript>
updateVersion = application.autoUpdater.getProductionVersion('SiteID'); // this would be done for each SiteID (e.g., default, etc.)
currentVersion = application.autoUpdater.getCurrentVersion();
readyForUpdate = updateVersion > currentVersion;
</cfscript>
<p>Mura's AutoUpdater works simply by comparing the <strong>updateVersion</strong> with the <strong>currentVersion</strong>. If the <strong>updateVersion</strong> is greater than the <strong>currentVersion</strong>, then it's ready for an update. This would be done on a site-by-site basis, and the updates differ between <strong>Core</strong> and <strong>Site</strong> versions.</p>
/**
* Vertically center Bootstrap 3 modals so they aren't always stuck at the top
*/
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
@stevewithington
stevewithington / bootstrap-input-with-fontawesome-calendar-icon.htm
Last active January 19, 2021 19:06
Bootstrap Input With FontAwesome Calendar Icon Example
<div class="form-group col-md-6">
<label for="somedate">Some Date</label>
<div class="has-feedback">
<input class="form-control" name="somedate" id="somedate" value="">
<span class="form-control-feedback"><i class="fa fa-calendar"></i></span>
</div>
</div>
@stevewithington
stevewithington / muraCustomUI.cfm
Last active December 14, 2023 09:50
Mura CMS: Example of how to use the 'Custom UI' container/tab assignment option when creating a class extension.
<!---
A brief example on how to use the 'CustomUI' option when creating a class extension in Mura CMS.
This example assumes you have an extended attribute called 'Page/Book'.
It also assumes you have an attribute set using the 'CustomUI' container/tab assignment.
Any extended attributes you assign to the attribute set, you are responsible for collecting
that data using your own form fields. Make sure the 'name' and 'id' attributes match the
names you've used when you created the extended attributes! For example, if you have an
extended attribute with a name of 'bookPublisher', make sure you have a form field with an
'id' and 'name' attribute of 'bookPublisher'. Check your casing too!
@stevewithington
stevewithington / muraArabicBody.cfm
Created August 18, 2015 16:42
Mura CMS: Add an Arabic Body/Content field and output properly on the layout templates.
<!---
First, create an extended attribute for Base/Default called 'arabicBody'
--->
<cfset arabicBody = $.setDynamicContent($.content('arabicBody')) />
<cfif Len(arabicBody)>
<div dir="rtl" lang="ar">
#arabicBody#
</div>
</cfif>