Accessibility Navigation

Entries Tagged as 'ColdFusion'

ColdFusion Auto Gallery

Creating a photo gallery can be time consuming for even a handful of images. Auto Gallery is a quick and dirty photo gallery tag meant to solve one problem. Automatically generating photo galleries from a folder of images and thumbnails. Team up autoGallery with Photoshop's Batch automation tools and you have a very quick gallery of images!

If your the type of person that just can't wait, here is a demo and download link.

View Demo | Download Zip

Read more...

iPhone Detection Scripts

With iPhones being all the rage these days, I am wondering if mobile versions of your pages might be useful. Viewing a site on an iPhone looks exactly as it does on your desktop. This is all well and good, but sometimes pages can be bloated with images, javascript libraries, and other markup that is not as important to your visitors. I am also a bit upset that the iPhone ignores the css media type of handheld. I wish there were an option to force Safari to render handheld styles as default, but I could not find any option for it. So I set out on a quest to find some alternatives for my iPhone experience.

Coldfusion – I was sure there was a way to get something from the cgi.http_user_agent but not sure if it would just read the agent as webkit. I didn't want to kill Safari desktop users, that would be bad. The Awesome Coldfusion Jedi Ray Camden already had a solution so here it is: (Sorry for the comments around the actual code. Seams that MangoBlog wants to parse the code and run it causing an error. So remove the comments from the cfif statement to make it work. I hope to get a fix for this soon)

<!--- detect iphone --->
<!---
<cfif findNoCase("iphone", cgi.http_user_agent)>
   <cflocation url="iphone.html" addToken="false">
</cfif>
--->

Javascript, PHP, and MVC – I ran across a site called iPhone Toolbox that has a ton-o-info on developing for the iphone. (I will be spending some time here for sure.) There is a set of scripts linked up there dealing with how to detect an iPhone users that pretty much covers the rest of the developers. Here is that code

Client-side (javascript):
    if (navigator.userAgent.indexOf('iPhone') != -1) {
       /* iPhone user */
      }
   
Server-side (example is PHP):
    if (stristr($_SERVER['HTTP_USER_AGENT'],'iPhone')) {
       /* iPhone user */
      }
   
For sites that use an MVC coding pattern where the programming logic code is separate from the template, the following example is useful:
    if (stristr($_SERVER['HTTP_USER_AGENT'],'iPhone')) {
       $template = 'home/iphone.html';
      }
      else {
       $template = 'home/index.html';
      }

If you have any other cool resources, I would love to hear about them. I did run into another site with some code to detect iPhone's and iPod's, but I couldn't make it work, so I have no idea if you have to detect them separately or not. It does speak to the reason why Apple should have an option in the settings pane to make an iPhone or iPod use a handheld stylesheet. But for now at least there is a work around.

Mango Event Start Template

As I was developing my own skins I kept running into issues where I forgot to include some necessary event triggers. So I stripped out al the layout code leaving only the core tags that I can use as a starting point for a template. Here is what was left. Not much really. Let me also add, that I am not very familiar with mango just yet, so if I am missing information please let me know so I can add it. Perhaps the few developers that are currently working with Laura (the author of mango) we can help her write the much needed documentation.

So here is the code. You may also download a nifty zip archive of the page template.

<!--- //----------------- Include the mango tag libraries -----------------// --->
<cfimport prefix="mango" taglib="../../tags/mango">
<cfimport prefix="mangox" taglib="../../tags/mangoextras">
<cfimport prefix="template" taglib=".">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <!--- //----------------- Header for author information, css and rss -----------------// --->
   <meta http-equiv="Content-Type" content="text/html; charset=<mango:Blog charset />" />
   <meta name="generator" content="Mango <mango:Blog version />" />
   <meta name="description" content="<mango:Blog description />" />
   <meta name="robots" content="index, follow" />

<link rel="stylesheet" href="<mango:Blog skinurl />assets/styles/styles-site.css" type="text/css" />

   <link rel="alternate" type="application/atom+xml" title="Atom" href="<mango:Blog atomurl />" />
   <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<mango:Blog rssurl />" />   
   <link rel="EditURI" type="application/rsd+xml" title="RSD" href="<mango:Blog apiurl />" />

<title><mango:Blog title /></title>
   <mango:Event name="beforeHtmlHeadEnd" />
</head>

<body>
<mango:Event name="beforeHtmlBodyStart" />

<!--- //----------------- Sidebar Events -----------------// --->
<mango:Event name="afterSideBarStart" number="1" />
<mango:Event name="beforeSideBarEnd" number="1" />

<!--- //----------------- Footer Events -----------------// --->
<mango:Event name="afterFooterStart" />
<mango:Event name="beforeFooterEnd" />

<mango:Event name="beforeHtmlBodyEnd" />
</body>
</html>