Home | Projects | Downloads | Contact Me | SQL Injection Attacks

Mobile pages for BlogCFC Part Deaux

Well, I think I am about ready to wrap up the mobile pages for BlogCFC.  Trying to keep in theme with the blog, I just created a layout_mobile.cfm page that is almost an exact copy of the layout.cfm file shipped with BlogCFC, minus the navigation pane.  This will leave all your default look and feel of your blog in tact.

Also, I created a mobile_comment.cfm since my mobile browser did not play well with pop-ups.  This basically removes the pop-up related code and just links the pages directly.  Also, all the basic functionality of the comment form is preserved such as the Captcha, Remember Me and Subscribe functions.

Installation:
Installation consists of adding a block of code in the index.cfm file and copying three other files to the blog.

Step 1:

The only real change to the code base is done at the head of the index.cfm page which will redirect mobile browsers to your mobile page.  Just include this code underneath Ray's header:

<cfif findNoCase("PPC",CGI.HTTP_USER_AGENT) or
      findNoCase("iPhone",CGI.HTTP_USER_AGENT)>
    <cfif not len(CGI.QUERY_STRING)>
        <cflocation url="/mobile.cfm" addtoken="false">
    <cfelse>
        <cflocation url="/mobile.cfm?#CGI.QUERY_STRING#" addtoken="false">
    </cfif>
</cfif>

This will automatically redirect Pocket PC and iPhones to the mobile page.  I do not have an iPhone to play with, but I have tested it out with my PPC and it seems to work just fine.

Step 2:
 
Copy layout_mobile.cfm to your BLOGROOT\tags folder.  This is the layout file for your mobile browsers.

Step 3:

Copy mobile.cfm and mobile_comment.cfm into the BLOGROOT and that is pretty much all there is to it.

Update: The files are now available for download at http://www.kisdigital.com/downloads.

Related Blog Entries

Comments
Shane Zehnder's Gravatar Through trial and error I have added some more user agents:

<cfif findNoCase("Windows CE",CGI.HTTP_USER_AGENT) or
    findNoCase("iPhone",CGI.HTTP_USER_AGENT) or
    findNoCase("iPod",CGI.HTTP_USER_AGENT) or   
    findNoCase("BlackBerry",CGI.HTTP_USER_AGENT) >
   
   <cfif not len(CGI.QUERY_STRING)>
      <cflocation url="/mobile.cfm" addtoken="false">
   <cfelse>
      <cflocation url="/mobile.cfm?#CGI.QUERY_STRING#" addtoken="false">
   </cfif>
</cfif>

Any suggestions on user agents to look for welcomed.
# Posted By Shane Zehnder | 3/24/08 7:48 PM
Layout: Shane Zehnder ::: BlogCFC was created by Raymond Camden. ::: This blog is running version 5.9.