The Extended Attributes functionality in Mura CMS is remarkably powerful, allowing developers to extend their content objects to include custom fields and attributes of almost any type.

However, it isn't always clear how to collect or search on the values of the custom attributes you have added, since Mura's default 'feed' object does not contain the extended attributes you have added.

Here's a quick example.

In a current project, I have an extended attribute of "courseCode" and I need to find all of the existing content items where the code is not blank. (in a normal SQL query this would looks something like WHERE courseCode != "")

To do this we'll use the Mura feedManager. The trick is the adding of a custom search parameter using "addParam()".

view plain print about
1<!--- collect existing course numbers --->    
2<cfset feed=application.feedManager.read('')>
3<cfset feed.setSiteID('MY SITE ID HERE')>
4<!--- filter feed on the courseCode attribute not blank --->
5<cfset feed.addParam(relationship="AND", field="courseCode",criteria="",condition="!=", dataType="varchar")>
6<cfset feedContents=application.feedManager.getFeed(feed) />
7        
8<cfdump var="#feedContents#">
9<cfabort>

This results in a query object called "feedContents" which contains all of the pages where "courseCode" is not blank.

Note: the feed (or query object) does -not- contain the extended attribute. In order to get that value I have to iterate through the contents of the feed and get the content value for that attribute. But this does give me a way to search for content based on the value of the attribute, then display or handle it however I want from there.