Farcry Snippets

I blogged a little while back that I was going to be entering Todd Sharp's Snip-A-Thon 2007!I've been adding a few snippets - not as many as I'd hoped - but I've added a few and I'm amazingly currently in 3rd position!

Part of what I've been trying to do is to make some meaningful and useful snippets for Farcry 4 that anyone can use when they are developing Farcry solutions. The idea is that theses snippets would provide useful examples of how to use the many core tags, as well as, making it easier to start creating your own custom data types.

What I've done so far is add a library to CFSnippets for Farcry, which you can find and subscribe to here : http://snipurl.com/farcrysnippets and I've added a couple of very simple snippets. These are :

  1. FT String property - for adding Form Tool string properties to a custom data type
  2. Insert Image from ObjectID Widget - using the imageDisplay widget
  3. Build Simple Text link - using the buildlink webskin tag
  4. Import Tags for webskin and widget tag libraries

I plan to add more as I get the opportunities, but please don't let that stop you from adding your own Farcry snippets and joining in the Snip-a-thon. ;)

Snipex Snipathon - the gloves come off.

I happened to glance at google reader and spotted that Andy Allan had posted a new entry - snip... snip... snip.... I generally read Andy's blog anyway to see what he's not been telling me about already, but this time I was... what the hell are you on about!?! So I went straight ahead and read it - be damned with the other 317 unread items!

Turns out Todd Sharp is running a grand Snip-a-thon competition to get us all using his most excellent new site CFSnippets.org

Now I've been meaning to use CFSnippets for a while, as well as making better use of snippets in cfeclipse, but not actually got around to it, so now I've got a challenge for myself!

  • Use snippets more
  • Upload the snippets to cfsnippets.org
  • Add all those Farcry snippets I've been promising myself I would do
  • beat Andy Allan

Nothing like a friendly bit of competition. ;)

UPDATE: I should probably mention that I'm mr_nil on snippex, twitter and pretty much anywhere else you might see that name....

Farcry 4 training course released.

Farcry is my CMS of choice and have the privilege of being a contributor to the code-base, so I'm a little biased.

I'm also pretty terrible at reading books and documentation, I learn better by getting my hands dirty, but even I have to admit that the documentation for Farcry 3 was pretty sparse. The Farcry 4 the online docs are a lot better and now there is a brilliant addition to that documentation.

This morning Geoff Bowers released the Daemon Farcry 4 Training Manual under Creative Commons licence for non-commercial use.

The training manual covers their 3 day course and give 122 pages of goodness that should help anyone get started with the basics and some of the more advanced techniques.

I would definitely recommend that anyone interested in Farcry take a good long look at this manual.

Farcry 4.01 Released!

The beta of Farcry 4, code name Gonzales, has been available since July of last year and has undergone some major work and changes.

About a month ago, Farcry 4 was quietly released, because the plug-ins weren't ready for 1.0.0 release. Now Farcry 4.01 has been officially with 3 plug-ins.

Farcry 4.01 was released at about 9:30am GMT today with 3 plug-ins. Download the suite at http://www.farcrycms.org/go/downloads

Included in the suite is :

  • core (4.0.1)
  • plugins/farcrycms (1.0.0)
  • plugins/farcrycfximage (1.0.0)
  • plugins/googleMaps (1.0.0)

Documentation for Farcry 4's new features is steadily expanding. If you have problems with the port number of the wiki, some documentation can be found on the Google Groups.

The Farcry-Dev and Farcry-Beta are excellent places to get more information and help with Farcry and developing with Farcry.

If you're coming to Scotch it would appear that I'll be giving a presentation on Farcry, so I'll be able to tell you more about its new features there!

A big thanks to Geoff Bowers and his team at Daemon Internet Consultants for all their hard work with this release of FarCry.

Farcry 4 : Beta in flux.

Very very quick note.

There have been some great posts and a lot of interest in Farcry 4 recently, which is excellent to see.

Just a little warning though.... If you're thinking of looking into Farcry 4, leave it a couple of days.

The guys at Daemon are doing a lot of work on it to make into a more cohesive product. These changes will take Farcry 4 to Beta 2.

"farcry_core" will be becoming just plain "core", so calls to core code will be farcry.core.packages etc.
"farcry_lib" will be becoming "plugins" - just a change of terminology.
"fourq" will no longer be a separate entity and will included as part of the farcry core.

Or at least that's what I was told at 9:30am this morning - it may change yet. ;)

It should be good! And I'm looking forward to playing with the new build.

Farcry 4 : Google Maps library.

I've been playing with Farcry 4 code name Gonzales since November last year and its now coming along with leaps and bounds. The form tools are a joy to behold! Creating custom data types is now an utter delight! All you have to do is run set up your properties, deploy the type, scaffold the admin and you're all set to use your new type! But I digress! This is something I'll have to write about another day.

One of the other new features of Farcry 4 is libraries. A lot of the CMSs you see out there, postnuke, e107, mambo etc. all have the ability to plug in new modules developed by the swathes of unwashed php developers out there. ;oD Farcry has always had this ability through custom types, but in FC3 its all a bit embroiled in the specific project or the core code. The new library functionality makes it much easier to create discrete applications that can be easily plugged into Farcry.At the minute, there are only a couple of libraries officially available. There's the farcrycms library, which provides the news, events, links and facts content items that are available in FC3. There is a farcrycfximage library, that overrides the built in Java image manipulation stuff (currently based around the imageJ cfc) and, lastly, there's a googlemaps library.

Daemon's Michael Sharman put together two custom types, googleMap and googleMapLocation.

The googleMapLocations type allows you to add locations using geocoding or specific lat/long figures along with a description that will be displayed in an info box and you can specify a icon from the image library that will be used for that location.

The googleMap type allows you to set up the controls for your map; the height and width of the map, will the map type control be displayed (Map/Hybrid/Sat), the zoom level at which your map will start being displayed, what if any map controls will be available and whether the map overview will be displayed.

Lastly, when you're editing your map record, there is an "open library" button. Clicking on this will open a window that allows you to drag and drop locations you previously entered or add a new location. When you've selected or added all your locations and returned to the editor you'll find a these locations. The top item in this list will be the centre point of your map. You can drag any of your locations to the top of the list courtesy of the joys of AJAX.

The library has a couple of webskins for maps, one of those is the actual display of the Map (displayMap) and the other is a standard display page for the map (displayPageStandard), but there is also a rule, so you can either add the map to your navigation using the standard page or use the rule to include the map in a container on a page.

A quick note about the icons, and a little brag: I added the icon selection to the library, which I was quite pleased about, but I've just been having a chat with Geoff Bowers. Its looking like another type will be added to the library. This will be a googleMapIcon type. This will allow you to set up a library of icons, including their shadows, anchor points and other icon properties, which you will be able to assign to a map location.

If you want to see the maps in action, Geoff has one on the WebDU site and my colleague Claire has put one together for the Dott Projects with another soon to come that will show all the schools taking part in the ECO Design Challenge.

Also Geoff has just posted a blog entry and a video showing just how easy it is to set up and use the google maps library.

Farcry dmFact with teaser image.

I'm going to post a few articles on "stuff" relating to Farcry 3 and doing some introductions to new features in Gonzales (Farcry 4 Beta).

Here's a short one to get me started.

Steven Clason recently asked on the farcry dev list how do I get the filename for an teaser image that has been added to a fact.There are two answers to this question, the first is blog entry posted by Trond Ulseth which uses the FourQ tag contentobjectget. This works well, but its a trap I fell into recently when I moved the Dott website to Gonzales from FC 3.x.

The problem comes when the path to the images moves, which it does in Gonzales. Gonzales moves all the images into appropriate folders under the image folder, so Source image go in a "Source" folder and thumbnails go in a "Thumbnail" folder. Trond's code, and the code I had previously written, falls down because it has the "/images/" path hardcoded into the webskin.

view plain print about
1<img src="/images/#getObject.imagefile#" align="right" alt="#getObject.alt#" />

To get around this problem the dmImage component has a method in it that returns the URL for a given dmImage ObjectID.

Its pretty easy to use. Create an object that points to the dmImage type component and call the the method getURLImagePath(). The method takes two parameters; the first is the ObjectID of the image and the second is the image type that you want the URL for. The image types are thumb, optimised and original. In Gonzales, these equate to thumbnail, standard and Source respectively.

So at the top of your webskin you will have something that looks like this :

view plain print about
1oImage = createobject("component","farcry.farcry_core.packages.types.dmImage");
2imagePath = oImage.getURLImagePath(stObj.ImageID,"original");

In the HTML you would use the variable imagePath in place of "/images/#getObject.imagefile#" for the src attribute.

So that has got you the URL for the image, but not the alt text or any of the other image information that is available to you. To get this data you can call the getData() method that is inherited from the types cfc, giving you something like this :

view plain print about
1oImage = createobject("component","farcry.farcry_core.packages.types.dmImage");
2stImage = oImage.getData(stObj.ImageID);
3imagePath = oImage.getURLImagePath(stObj.ImageID,"original");

stImage is a structure returned by the getData() method containing the data for the given imageID. In this structure you will find the title, alt tag, status, height and width of the image as well as the file names for the various types of image. Do a cfdump of this structure to see what you get or take a look at /farcry_core/packages/types/dmImage.cfc for the properties.

Now you can add your alt tag and the image height and width to the img tag in your webskin.

view plain print about
1<img src="#ImagePath#" height="#stImage.height#" width="#stImage.width#" alt="#stImage.alt#" title="#stImage.title#">

A quick note here : in Gonzales the height and width properties are deprecated, so may be empty if you've added images to the library in a Gonzales install.

So all in all your webskin will look something like this :

view plain print about
2 oImage = createobject("component","farcry.farcry_core.packages.types.dmImage");
3 stImage = oImage.getData(stObj.ImageID);
4 imagePath = oImage.getURLImagePath(stObj.ImageID,"original");
7<div class="dmFactImageTeaser">
8 <div class="title"><a href="#stObj.Link#">#stObj.Title#</a></div>
9 <div class="body">
10 <img src="#ImagePath#" height="#stImage.height#" width="#stImage.width#" alt="#stImage.alt#" title="#stImage.title#">
11 #stObj.Body#
12 </div>

This will work for Farcry 3, but for height and width information in Gonzales you'll need to use the recently added farcry.simpleimage component. When I've done this myself I'll post an update and add an image fact webskin to the farcrycms library.

UPDATE : I noticed a typo in the path to the dmImage component. "package" should be "packages" - all corrected above I think

UPDATE No.2 : It occurs to me that it would be better practice to use the application.packagepath variable to specify the "farcry.farcry_core" part of the path to the core types folder, so the create object would be :

view plain print about
1oImage = createobject("component","#application.packagepath#.types.dmImage");

Farcry 3 : Installing and updating

Starting at the beginning here's the first of my articles about Farcry.

Installing Farcry is a pretty painless process as long as you remember to do the updates after installing and before you get into the webtop. So what you need?I'm going to assume you have a web server, coldfusion server and database server installed and ready to go. On the works production server we have Apache, CFMX7 Standard and MySQL5. On my laptop I run MySQL 5, Apache and multiple instances of CFMX7 on JRun. (If you want to know how to set up multiple instances of CFMX take a look at the related articles.)

To install Farcry 3 you will need the farcry_core files, fourq files and farcry_mollio. You can download these files from the Farcry website, but I would strongly recommend getting the current release downloads from Jeff Coughlin's website. Jeff has a process that does a daily download of the latest set of files in Subversion which contain a number of small bug fixes and enhancements that aren't in the standard downloads.

Create yourself a "farcryapp" folder somewhere appropriate. On my laptop I have a second harddrive. At the top level I have a websites folder and I've created my farcryapp folder in there giving me a path of d:\websites\farcryapp. In your farcryapp folder create three folders :

  • farcry_core
  • farcry_mollio
  • fourq

Extract the content of each of the downloads into the matching folder. If you look in the farcry_core folder you should see :

  • admin
  • config
  • packages
  • plps
  • tags

Now we need a folder for our first farcry site. I'm going to call this "myproject". The my project folder needs to be created at the same level as farcry_core. Inside the "myproject" folder you should create a "www" folder.

So thats all the files set up. Before we can run the installer for farcry you need to set up a virtual directory in your webserver, a mapping in coldfusion and database.

For the database, simply create an empty database schema with a username and password in your chosen DBMS and a datasource entry in the ColdFusion administrator.

In your web server you need to create a virtual directory for the admin folder inside farcry_core and you also need to point the website root to the www folder in your project folder, so in my case I have :

view plain print about
1DocumentRoot "D:\websites\farcryapp\myproject\www"
2Alias /farcry "D:\websites\farcryapp\farcry_core\admin"

If you haven't already make sure you have virtual directories for "/cfide" and "/CFIDE", so that you at least have access to the "/cfide/scripts" folder.

In ColdFusion you need a mapping for "/Farcry". This should point to your farcryapp folder in my case d:\websites\farcryapp\

Thats all the files and mappings you need. Next is to run the installer.

Open a browser to http://mysite/farcry/install where "mysite" is the domain name for your site and you'll get a page that looks like this

The site name is the name of the site folder that you created, so for me this is "myproject". Select the database you created and added to ColdFusion from the drop down. Select the appropriate database type and set the owner prefix. If you're using MySQL this should field should be cleared. The next two mapping fields can be left as they are and the domain name should already be showing in the last box.

Its possible to change these entries so that you can set up additional websites under one farcry_core installation. The only thing to note is make sure you have already created the "projectname/www" folders before you run the installer.

You've then got a tick box to only install the database. This is useful if you want to refresh the database and start from scratch without overwriting all the site files. Leave this blank at this time as we want the installer to set up the site files as well as the database.

The last tick box is to delete the farcry_mollio folder when the install is complete. You can tick this if you want. You've always got the downloaded zip if you need a new copy.

Clicking on the INSTALL button will set the process of copying the farcry_mollio files into your site folder and creating all the necessary database tables, initial data and configuration files.

When the installer completes - don't be tempted to go and look at the newly install site or the webtop. Just move straight on to the updater. Load up the page http://mysite/farcry/updates in your browser and scroll down to the bottom. At the bottom of the page you'll see two updaters b300 and b301. Check the boxes alongside each of these and hit the "deploy updates" button. Take no notice of any errors that come up and let it run through to the end. If you downloaded the latest files from Jeff' website that should be it and you can now log in to the webtop and look at the default mollio website that you get. If you didn't get the latest file, there's one last update that you need to run. Load up http://mysite/farcry/updates/fu.cfm and then you'll be done. ;)

You can find the webtop at http://mysite/farcry and your site at http://mysite/ The default username and password for FC 3, which you should change as soon as you log in is "farcry" and "farcry".

I hope this helps someone get started with Farcry.

Next entry I'll go through some simple content management and a couple of little updates that you can do to farcry, including enabling Friendly URLs.

Farcry 3 presentation

Well I did the demo last night. Of course, as it was my first time presenting using Adobe Connect, it and JRun knew this and made my life hell from the very start.I checked everything was running, shut down things I didn't need, made sure I was sharing the correct desktop and had all my bits and pieces together.

I start my demo and JRun starts playing up. The default cfadmin instance is running after I had shut it down and my demo instance has stopped. Who knows what was going on there!

After that JRun and Connect competed to get as much of the computer's CPU as possible, slowing both of them down. Because of this I didn't get as far as talking about Farcry 4. I'll probably be doing another presentation soon (practice makes perfect after all) solely about Farcry 4, but if you want to see/hear what I did manage to talk about you can see the recording here : http://adobechats.adobe.acrobat.com/p40259141/

Also attached to this entry is a rar of the files for the custom type I built. I plan to write a few articles of exactly what should have happened in my demo last night to explain the content of these files.

Farcry Presentation Update

After my failed attempt to sort myself out to do a presentation last night, I am ready (as I'll ever be) to do my presentation tonight.

Take a look at the related entry for what I'm going to be talking about, but here are the Adobe Connect details and the presentation time.

Title : Farcry Basics and an Intro to Gonzales, Farcry 4
Time : 8pm GMT
Date : Thursday November 30th
Location : Adobe Connect

I'm actually pretty nervous about this presentation, but also looking forward to it too now! I just hope I don't end up talking to myself ;)

More Entries