Last active
December 2, 2020 17:18
-
-
Save stevewithington/9254239 to your computer and use it in GitHub Desktop.
Mura CMS : This example demonstrates how to obtain a content feed based on the contentid, type, and/or subtype.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
public any function getChildrenFeedByContentID( | |
required contentid | |
, string type='' | |
, string subtype='' | |
) { | |
var local = {}; | |
local.feed = $.getBean('feed'); | |
local.feed.setMaxItems(0); | |
local.feed.setNextN(0); | |
local.contentBean = $.getBean('content').loadBy(contentid=arguments.contentid); | |
if ( !local.contentBean.getIsNew() ) { | |
local.feed.addParam( | |
relationship='AND' | |
,field='tcontent.path' | |
,dataType='varchar' | |
,criteria=local.contentBean.getContentID() | |
,condition='CONTAINS' | |
); | |
} | |
if ( Len(arguments.type) ) { | |
local.feed.addParam( | |
relationship='AND' | |
,field='tcontent.type' | |
,dataType='varchar' | |
,criteria=arguments.type | |
); | |
} | |
if ( Len(arguments.subtype) ) { | |
local.feed.addParam( | |
relationship='AND' | |
,field='tcontent.subType' | |
,dataType='varchar' | |
,criteria=arguments.subtype | |
); | |
} | |
return local.feed; | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment