FarCry LESS Plugin

Today I released a plugin for FarCry that will automatically compile your LESS files into CSS. No more need to compile on your development machine before you push to production, and no more need to punish your users by compiling on the client side with Less.js. While those solutions are perfectly acceptable, this plugin will let you simply code in LESS, then let FarCry do the work of serving compiled, minified CSS to your users.

The plugin uses a similar syntax to FarCry's built in skin:loadCSS tag so it should be instantly familiar. Be sure to read the installation instructions to avoid a couple of potential "gotchas".

Check it out on Github, and let me know if its useful for you, or if you would like to see any additional features.

FarCry Solr Pro

Jeff Coughin and I just launched a new FarCry plugin to enhance the search capabilities of your FarCry website. Check out his announcement or the plugin website for more information.

FarCry Slider Formtool

I posted this on the farcry-dev mailing list but thought I would post it here as well to help future googlers in need.

I have created a slider formtool for a client and thought it could be useful to others in the community. You can find the source for it here: https://gist.github.com/1230366

[More]

FarCry YouTube Plugin

One of our clients asked for better integration of their YouTube hosted videos on their FarCry website. They had been linking to the youtube.com URLs directly, leading traffic away from their website. Obviously, they would have preferred to keep those visitors on their site and engaged.

As some other clients have also expressed a desire to display YouTube videos on their sites, I decided to build the functionality as a FarCry plugin. This would allow me to move this feature set to any FarCry site.

At its foundation, the plugin works via two custom types and a scheduled task. The scheduled task runs and uses the YouTube API to grab the playlists and videos on the specified account (configurable via a FarCry config). If it finds those objects already in FarCry, it updates them with the latest data from YouTube, if its new, it adds it to the FarCry database. Any items found in FarCry that aren't returned by the API are deleted. The plugin gives you the ability to reorder the videos on a playlist via the FarCry webtop. All data is managed on the YouTube side. I may consider adding the ability to completely manage the videos and playlists on the webtop, but that will greatly increase the complexity of the plugin, and I don't see a great benefit to doing so. To me, it makes more sense to go straight to the source to upload new videos, manage your videos, etc rather than try to stuff all that functionality into a FarCry form. No need to reinvent the wheel, in my opinion.

The plugin also includes two rules. One lists videos based on selected playlists or videos, the other displays an embedded video.

To interact with the YouTube API, I made use of Raymond Camden's awesome YouTube CFC.

I am happy to say that I have also posted this code on Github for the entire community to use. Give it a try! If you have any ideas for improvement please open a ticket, or better yet, fork the project and send me a pull request.

You can find the project on RIAForge and Github.

FarCry Poll Plugin

I have released a plugin I have had for a while. I'm not sure why I never got around to releasing it. Its a very simple FarCry plugin that gives you the ability to create a one question poll and display it on the site. It uses a couple content types and a rule.

To install, copy the files to /farcry/plugins/spcPoll and add "spcPoll" to your "this.plugins" setting in your FarCry constructor. Deploy the content types in the COAPI manager and restart the application. You can now create a question, assign answers to it, and deploy that question using the "Poll: Display Poll" rule.

You can grab the code on Binpress or Github. Its also attached to this entry via the download link below.

Let me know what you think!

A FarCry plugin for Hoth: ColdFusion Exception Tracking

Just a quick note to mention that I have released a FarCry plugin for the Hoth exception tracking framework. If you are interested take a look at the code on GitHub and let me know what you think. I have also included a zip file of the code attached to this entry.

Integrate a Model-Glue Application into FarCry

I'm sure there are other ways to do this but this is how I was able to integrate an existing Model-Glue application into a FarCry site. I am using ModelGlue 2.0, the latest ColdSpring BER as of this posting, and the latest beta of reactor. My MG app in question is a events calendar. Its a pretty simple application using MG, Reactor, and ColdSpring. Because I don't want to use ColdFusion mappings (and its running on CF7 so no per application mappings) I copied modelglue, reactor, and coldspring into {farcry_root}/projects/{site_name}/www as www/modelglue, www/reactor, and www/coldspring. If you are using mappings you can skip that step. Next, I created a simple include file called _mgCal.cfm in {farcry_root}/projects/{site_name}/includedObj. The code for this is as follows:

view plain print about
1<!--- @@displayname: Calendar --->
2
3<cfsetting
4enablecfoutputonly="no">

5
6<cfinclude template="/mg/mgCal/index.cfm"
7/>

8
9<cfsetting enablecfoutputonly="no">
Now, in the FarCry webtop, under the site tab, navigate to the root node, and under utility, create a new navigation node called "Calendar" and under that, a new include called "Calendar". Publish both. The friendly URL should be /go/calendar, but it can be whatever you like. Now we have to copy our MG application into the site tree. Create a new folder called "mg" under the www folder. This is where all my MG apps will live. So I copy my "mgCal" folder from my test site into the "mg" folder I just created giving me a directory structure like so:
/www/mg/mgCal/
/www/mg/mgCal/config
/www/mg/mgCal/controller
/www/mg/mgCal/model
/www/mg/mgCal/views
/www/mg/mgCal/Application.cfm
/www/mg/mgCal/index.cfm
etc
Now we have a few modifications to make to the MG app to get it to run from this location. Depending on how you first created the MG app, your settings may be different. In your MG App's index.cfm file add the following line above the <cfinclude> that calls Model-Glue.
view plain print about
1<cfset ModelGlue_LOCAL_COLDSPRING_PATH =
2getDirectoryFromPath(getCurrentTemplatePath()) &
3"/config/ColdSpring.xml" /
>

Now MG can find your ColdSpring configuration file. In your ColdSpring configuration file edit the following properties: In your modelGlueConfiguration bean: The paths should be straight forward, but your defaultTemplate property must be set to the FriendlyURL of your include.
view plain print about
1<property
2name="viewMappings">
<value>/mg/mgCal/views</value></property>
3<property
4name="generatedViewMapping">
<value>/mg/mgCal/views/generated</value></property>
5<property
6name="configurationPath">
<value>/mg/mgCal/config/ModelGlue.xml</value></property>
7<property
8name="scaffoldPath">
<value>/mg/mgCal/config/scaffolds/Scaffolds.xml</value></property>
9<property
10name="defaultTemplate">
<value>/go/calendar</value></property>
In your reactorConfiguration bean:
view plain print about
1<constructor-arg
2name="pathToConfigXml">
<value>/mg/mgCal/config/reactor/Reactor.xml</value></constructor-arg>
3<property
4name="mapping">
<value>/mg/mgCal/model/data/reactor</value></property>
You will want the paths to match those you set up in the previous steps. Now for the tedious part. This was easy for me since I only have a few views, but a complex app with a large number of views will probably be a bit more work. In each view that calls #viewState.getValue('myself')# you will have to, prior to any of those calls run the following statement:
view plain print about
1<cfset
2viewState.setValue('myself',replace(viewState.getValue('myself'),'?','&amp;','ALL'))
3/
>

This is to prevent a url like /go/calendar?event=some.mgEvent from happening. The friendlyURL is hiding some other FarCry URL variables. So there is already a ? in the URL. This will replace the ? that MG creates with an ampersand so you can attach the MG url variables. easily. Thats all it took to get my simple calendar MG app running under FarCry. A more complex app may need more to get running, but at least this will get you started. If any one has any suggestions on a better way to handle this, I am all ears. I tried to find another instance of someone doing this in both the FarCry and Model-Glue lists to no avail.

Fork me on GitHub