Skip to content

Instantly share code, notes, and snippets.

View PeterBowater's full-sized avatar

Peter Bowater PeterBowater

  • Wedmore, Somerset
View GitHub Profile
@stevewithington
stevewithington / muraImage.cfm
Last active April 28, 2020 15:26
Mura CMS : Meta Image / Primary Associated Image Output
<!---
This is one way to generate a custom meta image based on the content item's primary associated image.
You could use this method in several other ways as well, such as inside a content iterator, etc.
If the fileid passed into this method is not a valid image, then it will return an empty string
--->
<cfif Len($.getURLForImage($.content('fileid')))>
<cfscript>
img = $.getURLForImage(
fileid = $.content('fileid') // could be _any_ fileid in Mura
,size = 'custom' // small, medium, large, custom, or any other pre-defined image size
@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>
<!---