Skip to content

Instantly share code, notes, and snippets.

@JonasEriksson
Created October 13, 2018 13:45
Show Gist options
  • Save JonasEriksson/9d56b8613ba2b80f69d0feaf7110b054 to your computer and use it in GitHub Desktop.
Save JonasEriksson/9d56b8613ba2b80f69d0feaf7110b054 to your computer and use it in GitHub Desktop.
Mura CMS - dspCountiesList from external DB (add to contentRenderer.cfc)
<!--- dspCountiesList - JE added 20181013 --->
<cffunction name="dspCountiesList" output="false">
<cfargument name="returnInfo" required="no" default="codes">
<cfquery name="getCounties" datasource="myresourcesimport" cachedwithin="#CreateTimeSpan(1, 0, 0, 0)#">
Select * From temp_data_county
Order By Countyname
</cfquery>
<cfset Counties = "">
<cfoutput>
<cfloop query="getCounties">
<cfswitch expression="#arguments.returnInfo#">
<cfcase value="codes">
<cfset Counties = listappend(Counties,getCounties.Countycode,"^")>
</cfcase>
<cfcase value="names">
<cfset Counties = listappend(Counties,"#getCounties.Countyname# (#getCounties.Countycode#)","^")>
</cfcase>
</cfswitch>
</cfloop>
</cfoutput>
<cfreturn Counties />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment