Other Sites in the News
- June 14, 2019
- 365 Connect to Explore the State of Mobile Trends and Technology in Live Webcast - PRNewswire
List All Mura Site Advertisers
Mura's CMS runs on ColdFusion, is free, and has turn-key modules for blogging, photo galleries, emailing and advertising. (If you need help on getting your basic Advertising Module up and working in Mura, please review this section first.)
I had a requirement to list all of the site's sponsors on a single page of a Mura site for posterity; sort of a dedicated "Thank You" for all the supporters - in addition to having their individual current ads rotating throughout the site.
Mura does not offer this feature by default; but the open architecture and upgrade protection makes for easy customization. Here's how I did it:
I wanted the sequence of advertisers to be shuffled every time the page was loaded - so that no single underwriter would get perpetual top-billing. So I added an artificial column to my database query - with the alias name 'randomSort'. The MySQL database generates a random number for this column using its RAND() function. If your Mura CMS is powered by other database technology, then you may need to replace this line with different function syntax. Sorting the resulting record set by this number (order by randomSort) would execute the shuffle.
c.name, f.fileID, redirectURL, c.altText,
isActive, height, width, target, title,
(FLOOR( 1 + RAND( ) *100 )) AS randomSort
from `tadcreatives` c
left join tfiles f
on f.fileID = c.fileID
where userID IN
where SiteID = '#request.siteID#'
and isActive = 1
order by randomSort
<a href="#getAdvertisers.redirectURL#" target="#getAdvertisers.target#" title="#getAdvertisers.title#"><img src="/#request.siteID#/cache/file/#getAdvertisers.fileID#.#listLast(getAdvertisers.filename,'.')#" style="max-width:300px; max-height:300px;" alt="#getAdvertisers.altText#"></a>
After the closing </cfquery> tag comes the presentation. In my case, I used a simple stack of div tags (one tag is rendered for each record in the query's <cfoutput> loop). I restricted the images to a universal size because advertising art can vary in size, and I didn't want sponsors to complain that someone else's logo was bigger than theirs! The site's stylesheet default settings should format the rest of it.
Place the above code into a file named listAdvertisers.cfm. Replace the 'mura' datasource name with your own. Place the file on your Mura server under the path [SITEID]/includes/themes/[THEME]/templates/components/ (where [SITEID] is your Mura Site ID word, and [THEME] is the name of the display theme your site is using.
Now you can create a Mura Component to hold this custom code. Assuming you have permissions to see it: click Components, then click Add Components. Give your Component a title and then click the Advanced tab. If you placed the file listAdvertisers.cfm correctly, then you should be able to select it from the Layout Template dropdown. That's it, click Publish to save your new component.
Your component is now ready for placement within a Mura CMS page - by using the Content Objects tab within the page edit tool. I used a dedicated top-level page for my client's "Sponsor Thank You" page, and just added my new component to main display section.
Hope this helps!