Florida SEO Try Catch Application.CFC

Okay, so I am only a year in to CF development now, and I still feeling about as confident with my skills as well, the first month I started ... don't ask me why, but I always seem to find a problem that baffles me. This time is not an exception.

I recently moved to Application.CFC ... (Don't know what that is? Don't worry, I know as much as you. Want to find out more? ... Ray "Raymond" has info on his site ... )

So, this move came about since I had no idea how to manage error handling for 404 pages in CF ... for instance, if a link to a page on my site was missing, or broken ... the 404 page would get returned. However, if someone requested a .cfm page that did not exist whatsoever ... then the "IIS" template would kick in ... Not Good ...

So, I wanted my 404 template to kick in even when someone requested a specific ColdFusion page as well as broken links, moved pages, anything else ...

The only way to get what I really needed ... a default error handler in CF for all pages ... was not going to be available on a shared hosting platform ... which my site is on ... Good thing that ColdFusion 8, has the functionality available by way of the onMissingTemplate function through Application.CFC ...

Now, I saw a few references regarding the cflocation tag ...

<cffunction name="onMissingTemplate" returnType="boolean" output="false">
   <cfargument name="thePage" type="string" required="true">
   <cflog file="somefiles" text="#arguments.thePage#">
   <cflocation url="404.cfm?thepage=#urlEncodedFormat(arguments.thePage)#" addToken="false">
</cffunction>

But this was a problem due to redirecting from a 404 page ... The search engines would definitely have a problem with a 404 page returning a "page moved temporarily" or a "page moved permanently" flag when in fact it didn't exist at all ... That would Not be good for the rankings ...

So, the answer it seems was to try a bit of a different solution ... similar, yet a bit different ... here's the next shot ...

<cffunction name="onMissingTemplate" returnType="boolean" output="true">
   <cfargument name="targetPage" type="string" required="true" />
   <cflog file="somefile" type="error" text="Missing template: #Arguments.targetPage#">
   <cfinclude template="404.cfm" />
   <cfreturn true />
</cffunction>

Generally it's not a real smart idea for a newbie coder such as myself to go playing around with really important functions on a production site ... but, then again I can't have problems with 404 pages either ... So, I chanced fate ... and came up with the solution above ...

I also created a custom 404 page which I am rather fond of ... if an event fires my 404 template ... I have an include of my site map so search engine robots can give me a some credit by crawling the sitemap ... and at the same time, I can offer my visitors a useful way to navigate a page that they might have been looking for ...

You have been warned! If, you decide to use a 404 page ... make sure that you don't include it either in your .xml site map ... and that you implement a header status 404 ...

<cfheader statuscode="404" statustext="Not Found" />

Furthermore, pay attention to your Meta Robots Tag ...

<meta name="robots" content="noindex, follow" />

If not ... you are basically telling the search engines that your pages exist ... (status 200 » okay ) ... and that will kill your search engine optimization efforts ... fast.

Florida SEO Bringing on Visuals - CFlickr CFC

I recently decided that it was about time to start adding some imagery to my Blog. I am the first person to go to bat for Content being the King on the web, but straight text content can at times be a little boring to look at. So I went on the hunt for a simple way to add life to my blog.

I found an API called CFlickr, that is written in ColdFusion and provides the ability to work with Flickr's REST API. There are some really cool examples of the things that you can do with the API over at SixFive.

CFlickr's developer, (Chris Blackwell), gives some very good examples of how the API can be used to develop dynamic pages through working with the API. He has even gone through the trouble of setting up the CFC's Documentation.

If you haven't ever worked with ColdFusion Components, there are a few things that you have to do to make sure that the component works correctly. If you are in a shared hosting environment, you will have to ask your host to provide a mapping to the directory where CFlickr is under your web root. Make sure you are careful to get the mapping right ... if you aren't ... you will find out really fast.

I'm not going to try to go in to a tutorial on using the API just yet, but if you are interested in learning more about it, you can get more at the CFlickr Site.

ColdFusion Components and OO Java - Closely Related - Not the Same

Recently I have been reviewing ColdFusion 8 - Beyond the Basics by David Gassner and I have ventured into the world of ColdFusion Components (CFC's). I am starting to get a better understanding of how ColdFusion, or CFML Pages, are processed in the JRun server and how CFC's relate somewhat to Object Oriented Java. First of all I had to find out that the CFML alone is not related to Java. However, there is an ability in ColdFusion to integrate in a hybrid environment with Java through the use of CFC's.

Since I am very new to CFC's, I will not attempt to explain the complex architecture that is involved in relating ColdFusion to Java, but rather what it is that I came to realize from the Beyond the Basics series and by doing a little research on CFC's and Java.

[More]

BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact Florida Search Engine Optimization L.L.C.
Search Engine Optimization Specialist || Web Designer || Web Developer || Edward J Beckett ||
Search Engine Optimization Company  || SEO Services || Internet Marketing Company || Search Engine Optimization Expert || Florida Search Engine Optimization LLC
Florida Search Engine Optimization || Search Engine Optimization || SEO Services || Florida SEO Blog
Florida Search Engine Optimization
Search Engine Optimization
SEO Services
Florida SEO Blog
July-04-2008
1:48 AM EST