diff --git a/lib/.configsnapshots/configsnapshot-2010-09-29 16-24-52.xml b/lib/.configsnapshots/configsnapshot-2010-09-29 16-24-52.xml
new file mode 100644
index 0000000000000000000000000000000000000000..95e6751887ecc2ac22eb540cba828647ea00f617
--- /dev/null
+++ b/lib/.configsnapshots/configsnapshot-2010-09-29 16-24-52.xml	
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<pearconfig version="1.0"><php_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/php</php_dir><ext_dir>/usr/lib/php/extensions/no-debug-non-zts-20090626</ext_dir><cfg_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/cfg</cfg_dir><doc_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/docs</doc_dir><bin_dir>/usr/bin</bin_dir><data_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/data</data_dir><www_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/www</www_dir><test_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/tests</test_dir><src_dir>/Library/WebServer/Documents/workspace/UNL_Elgg/lib/src</src_dir><php_bin>/usr/bin/php</php_bin><php_ini>/private/etc/php.ini</php_ini><php_prefix></php_prefix><php_suffix></php_suffix></pearconfig>
diff --git a/lib/.pear2registry b/lib/.pear2registry
index 4725af4a3c8e5ef360ce2e3221cbd16284336017..a91563c82a9051144ca7f6c4b13e488bced7b4a3 100644
Binary files a/lib/.pear2registry and b/lib/.pear2registry differ
diff --git a/lib/.xmlregistry/packages/pear.unl.edu/UNL_Templates/1.0.0RC9-info.xml b/lib/.xmlregistry/packages/pear.unl.edu/UNL_Templates/1.1.0-info.xml
similarity index 91%
rename from lib/.xmlregistry/packages/pear.unl.edu/UNL_Templates/1.0.0RC9-info.xml
rename to lib/.xmlregistry/packages/pear.unl.edu/UNL_Templates/1.1.0-info.xml
index 4b1688f1da19b875e71a6ac67e93ce4c9e9513a8..43e6f36a6a13d6ec265a13b42f65493dedafe817 100644
--- a/lib/.xmlregistry/packages/pear.unl.edu/UNL_Templates/1.0.0RC9-info.xml
+++ b/lib/.xmlregistry/packages/pear.unl.edu/UNL_Templates/1.1.0-info.xml
@@ -16,55 +16,22 @@
   <email>nhummel2@math.unl.edu</email>
   <active>yes</active>
  </lead>
- <date>2010-01-27</date>
- <time>10:09:00</time>
+ <date>2010-09-29</date>
+ <time>16:24:52</time>
  <version>
-  <release>1.0.0RC9</release>
+  <release>1.1.0</release>
   <api>1.0.0</api>
  </version>
  <stability>
-  <release>beta</release>
-  <api>beta</api>
+  <release>stable</release>
+  <api>stable</api>
  </stability>
  <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
  <notes>
 Feature Release!
-Added support for specifying the template version, 2 or 3.
-* UNL_Templates::$options['version'] = 3; to use the new templates.
-* Added the secure template.
-* Add debug template.
-* Updated Version 3 templates to reflect footer changes.
-
-Additional work to prevent broken pages.
-* If local files are not present for the &lt;!--#include statements, it will grab them remotely.
-* If wdn/templates_3.0 does not exist locally it will use a template with absolute references to prevent broken pages.
-
-New methods:
-* addHeadLink($href, $relation, $relType = 'rel', array $attributes = array())
-* addScript($url, $type = 'text/javascript')
-* addScriptDeclaration($content, $type = 'text/javascript')
-* addStyleDeclaration($content, $type = 'text/css')
-* addStyleSheet($url, $media = 'all')
-* __toString()  Now you can just use echo $page;
-
-Auto loading of files - now supporting:
-* optionalfooter=&gt;optionalFooter.html
-* collegenavigationlist=&gt;unitNavigation.html
-* contactinfo=&gt;footerContactInfo.html
-
-New Remote Template Scanner UNL_Templates_Scanner
-* Scans a rendered UNL Template page for the editable content areas.
-
-Other fixes:
-* Use static vars instead of PEAR::getStaticProperty() - fixes E_STRICT warnings
-* Remove debug code causing cache to never be used.
-* Fix debugging.
-* Merge UNL_DWT::$options with options from ini file instead of overwriting.
-* Set default timezone to use before we use date functions.
-* Add newlines after header additions.
-* Fix addScriptDeclaration method to comment out CDATA to prevent syntax errors.
-
-Add example of a custom class with auto-breadcrumb generation and body content loading.
+* Added the mobile template.
+* Fix support for version 2 templates.
+* Only set templatedependentspath if it has not been set.
  </notes>
  <contents>
   <dir name="/">
@@ -84,6 +51,10 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
+   <file baseinstalldir="/" md5sum="da29bd0de202f2fe27d593c1a35c4d65" name="UNL/Templates/Version3/Mobile.php" role="php">
+    <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
+    <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
+   </file>
    <file baseinstalldir="/" md5sum="5ae65bf4c045a5b9b65b726b52d6cd26" name="UNL/Templates/Version3/Liquid.php" role="php">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
@@ -104,7 +75,7 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
-   <file baseinstalldir="/" md5sum="f307432bd99d2cccc6ed4fca2782604e" name="UNL/Templates/Version3.php" role="php">
+   <file baseinstalldir="/" md5sum="95edca2102f2160a7b53162ca94a8b99" name="UNL/Templates/Version3.php" role="php">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
@@ -140,7 +111,7 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
-   <file baseinstalldir="/" md5sum="44c17f55c20fce235d7d2556dc43b23c" name="UNL/Templates/Version2.php" role="php">
+   <file baseinstalldir="/" md5sum="4c1b93f62221e5229be657196f07f048" name="UNL/Templates/Version2.php" role="php">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
@@ -152,6 +123,14 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
+   <file baseinstalldir="/" md5sum="4fa04418d0aa08834b4795caeae5b8c8" name="UNL/Templates/CachingService/UNLCacheLite.php" role="php">
+    <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
+    <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
+   </file>
+   <file baseinstalldir="/" md5sum="47991f0e5cffed6d138725a3294f4e6a" name="UNL/Templates/CachingService/Null.php" role="php">
+    <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
+    <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
+   </file>
    <file baseinstalldir="/" md5sum="5b09b184e7d59a2520e99c0b5c66428a" name="UNL/Templates/CachingService/CacheLite.php" role="php">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
@@ -160,7 +139,7 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
-   <file baseinstalldir="/" md5sum="66cf2ca7074e1ae7d602e94a438ff95a" name="UNL/Templates.php" role="php">
+   <file baseinstalldir="/" md5sum="1b3de8279d951ccb05f8ad61903f6b03" name="UNL/Templates.php" role="php">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
@@ -172,7 +151,7 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
-   <file baseinstalldir="/" md5sum="3c1307e7a73e10f1af082ec3a48e481f" name="docs/examples/example1.php" role="doc">
+   <file baseinstalldir="/" md5sum="3a3851e70662c3e0bb3ffbc7e5765325" name="docs/examples/example1.php" role="doc">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
@@ -188,6 +167,10 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
+   <file baseinstalldir="/" md5sum="a7114a3868d0ba54d4ff76b370ea3201" name="docs/examples/convert.php" role="doc">
+    <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
+    <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
+   </file>
    <file baseinstalldir="/" md5sum="742720269e3488e0fa34f0ad53b2cb00" name="data/tpl_cache/Version3/Shared_column_right.tpl" role="data">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
@@ -204,6 +187,10 @@ Add example of a custom class with auto-breadcrumb generation and body content l
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
    </file>
+   <file baseinstalldir="/" md5sum="922b27d1257d43020214ab70e2da5829" name="data/tpl_cache/Version3/Mobile.tpl" role="data">
+    <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
+    <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
+   </file>
    <file baseinstalldir="/" md5sum="962756c965f0f2881e88c83a72fe0545" name="data/tpl_cache/Version3/Liquid.tpl" role="data">
     <tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
     <tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
@@ -266,17 +253,24 @@ Add example of a custom class with auto-breadcrumb generation and body content l
    <pearinstaller>
     <min>1.4.3</min>
    </pearinstaller>
+   <package>
+    <name>UNL_DWT</name>
+    <channel>pear.unl.edu</channel>
+    <min>0.7.1</min>
+   </package>
+  </required>
+  <optional>
    <package>
     <name>Cache_Lite</name>
     <channel>pear.php.net</channel>
     <min>1.0</min>
    </package>
    <package>
-    <name>UNL_DWT</name>
+    <name>UNL_Cache_Lite</name>
     <channel>pear.unl.edu</channel>
-    <min>0.7.1</min>
+    <min>0.1.0</min>
    </package>
-  </required>
+  </optional>
  </dependencies>
  <phprelease>
   <changelog>
@@ -737,6 +731,76 @@ Other fixes:
 Add example of a custom class with auto-breadcrumb generation and body content loading.
    </notes>
    </release>
+   <release>
+    <version>
+     <release>1.0.0</release>
+     <api>1.0.0</api>
+    </version>
+    <stability>
+     <release>stable</release>
+     <api>stable</api>
+    </stability>
+    <date>2010-03-26</date>
+    <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+    <notes>
+Feature Release!
+Added support for specifying the template version, 2 or 3.
+* UNL_Templates::$options['version'] = 3; to use the new templates.
+* Added the secure template.
+* Add debug template.
+* Updated Version 3 templates to reflect footer changes.
+* Multiple template caching backends are 
+
+Additional work to prevent broken pages.
+* If local files are not present for the &lt;!--#include statements, it will grab them remotely.
+* If wdn/templates_3.0 does not exist locally it will use a template with absolute references to prevent broken pages.
+
+New methods:
+* addHeadLink($href, $relation, $relType = 'rel', array $attributes = array())
+* addScript($url, $type = 'text/javascript')
+* addScriptDeclaration($content, $type = 'text/javascript')
+* addStyleDeclaration($content, $type = 'text/css')
+* addStyleSheet($url, $media = 'all')
+* __toString()  Now you can just use echo $page;
+
+Auto loading of files - now supporting:
+* optionalfooter=&gt;optionalFooter.html
+* collegenavigationlist=&gt;unitNavigation.html
+* contactinfo=&gt;footerContactInfo.html
+
+New Remote Template Scanner UNL_Templates_Scanner
+* Scans a rendered UNL Template page for the editable content areas.
+
+Other fixes:
+* Use static vars instead of PEAR::getStaticProperty() - fixes E_STRICT warnings
+* Remove debug code causing cache to never be used.
+* Fix debugging.
+* Merge UNL_DWT::$options with options from ini file instead of overwriting.
+* Set default timezone to use before we use date functions.
+* Add newlines after header additions.
+* Fix addScriptDeclaration method to comment out CDATA to prevent syntax errors.
+
+Add example of a custom class with auto-breadcrumb generation and body content loading.
+   </notes>
+   </release>
+   <release>
+    <version>
+     <release>1.1.0</release>
+     <api>1.0.0</api>
+    </version>
+    <stability>
+     <release>stable</release>
+     <api>stable</api>
+    </stability>
+    <date>2010-09-09</date>
+    <license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD License</license>
+    <notes>
+Feature Release!
+* Added the mobile template.
+* Fix support for version 2 templates.
+* Only set templatedependentspath if it has not been set.
+   </notes>
+   </release>
   </changelog>
  </phprelease>
 </package>
diff --git a/lib/data/UNL_Templates/data/tpl_cache/Version3/Mobile.tpl b/lib/data/UNL_Templates/data/tpl_cache/Version3/Mobile.tpl
new file mode 100644
index 0000000000000000000000000000000000000000..3215adec8daa4fe8fc39e3cb1a011bce52f2e8f8
--- /dev/null
+++ b/lib/data/UNL_Templates/data/tpl_cache/Version3/Mobile.tpl
@@ -0,0 +1,67 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<!-- InstanceBegin template="/Templates/mobile.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!--
+    Membership and regular participation in the UNL Web Developer Network
+    is required to use the UNL templates. Visit the WDN site at 
+    http://wdn.unl.edu/. Click the WDN Registry link to log in and
+    register your unl.edu site.
+    All UNL template code is the property of the UNL Web Developer Network.
+    The code seen in a source code view is not, and may not be used as, a 
+    template. You may not use this code, a reverse-engineered version of 
+    this code, or its associated visual presentation in whole or in part to
+    create a derivative work.
+    This message may not be removed from any pages based on the UNL site template.
+    
+    $Id: mobile.dwt 536 2009-07-23 15:47:30Z bbieber2 $
+-->
+<link rel="stylesheet" type="text/css" media="screen" href="/wdn/templates_3.0/css/mobile.css" />
+<script type="text/javascript" src="/wdn/templates_3.0/scripts/mobile.js"></script>
+<!--#include virtual="/wdn/templates_3.0/includes/browserspecifics.html" -->
+<!--#include virtual="/wdn/templates_3.0/includes/metanfavico.html" -->
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>UNL | Department | New Page</title>
+<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" -->
+<!-- Place optional header elements here -->
+<!-- InstanceEndEditable -->
+</head>
+<body class="mobile">
+<p class="skipnav"> <a class="skipnav" href="#maincontent">Skip Navigation</a> </p>
+<div id="wdn_wrapper">
+    <div id="header"> <a href="http://www.unl.edu/" title="UNL website"><img src="/wdn/templates_3.0/images/logo.png" alt="UNL graphic identifier" id="logo" /></a>
+        <h1>University of Nebraska&ndash;Lincoln</h1>
+    </div>
+    <div id="wdn_content_wrapper">
+        <div id="titlegraphic"><!-- InstanceBeginEditable name="titlegraphic" -->
+            <h1>Department</h1>
+            <!-- InstanceEndEditable --></div>
+        <div id="pagetitle"><!-- InstanceBeginEditable name="pagetitle" --> <!-- InstanceEndEditable --></div>
+        <div id="maincontent">
+            <!--THIS IS THE MAIN CONTENT AREA; WDN: see glossary item 'main content area' -->
+            <!-- InstanceBeginEditable name="maincontentarea" -->
+            <p>Place your content here.<br />
+                Remember to validate your pages before publishing! Sample layouts are available through the <a href="http://wdn.unl.edu//">Web Developer Network</a>. <br />
+                <a href="http://validator.unl.edu/check/referer">Check this page</a> </p>
+            <!-- InstanceEndEditable -->
+            <div class="clear"></div>
+            <!--#include virtual="/wdn/templates_3.0/includes/noscript.html" -->
+            <!--THIS IS THE END OF THE MAIN CONTENT AREA.-->
+        </div>
+        <div id="footer">
+            <div id="footer_floater"></div>
+            <div id="wdn_copyright"><!-- InstanceBeginEditable name="footercontent" -->
+                <!--#include virtual="sharedcode/footer.html" -->
+                <!-- InstanceEndEditable -->
+                <ul>
+                    <li><a href="http://validator.unl.edu/check/referer">W3C</a></li>
+                    <li><a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3">CSS</a></li>
+                </ul>
+                <!--#include virtual="/wdn/templates_3.0/includes/wdn.html" -->
+                <a href="http://www.unl.edu/" title="UNL Home" id="wdn_unl_wordmark"><img src="/wdn/templates_3.0/css/footer/images/wordmark.png" alt="UNL's wordmark" /></a> </div>
+        </div>
+    </div>
+    <div id="wdn_wrapper_footer"> </div>
+</div>
+</body>
+<!-- InstanceEnd --></html>
diff --git a/lib/docs/UNL_Templates/docs/examples/convert.php b/lib/docs/UNL_Templates/docs/examples/convert.php
new file mode 100644
index 0000000000000000000000000000000000000000..f16cee1a920f7454552afff3648e2937605588ba
--- /dev/null
+++ b/lib/docs/UNL_Templates/docs/examples/convert.php
@@ -0,0 +1,37 @@
+#!/usr/bin/env php
+<?php
+if (!isset($_SERVER['argv'],$_SERVER['argv'][1])
+    || $_SERVER['argv'][1] == '--help' || $_SERVER['argc'] != 2) {
+    echo "This program requires 1 argument.\n";
+    echo "convert.php oldfile.shtml newfile.shtml\n\n";
+    exit();
+}
+
+require_once 'UNL/Autoload.php';
+
+if (!file_exists($_SERVER['argv'][1])) {
+    echo "Filename does not exist!\n";
+    exit();
+}
+
+UNL_Templates::$options['version'] = 3;
+UNL_Templates::$options['templatedependentspath'] = '/Library/WebServer/Documents';
+
+
+$p = new UNL_Templates_Scanner(file_get_contents($_SERVER['argv'][1]));
+
+
+
+$new = UNL_Templates::factory('Fixed');
+UNL_Templates::$options['templatedependentspath'] = '/Library/WebServer/Documents';
+
+
+foreach ($p->getRegions() as $region) {
+    if (count($region)) {
+        $new->{$region->name} = $region->value;
+    }
+}
+UNL_Templates::$options['templatedependentspath'] = 'paththatdoesnotexist!';
+
+echo $new;
+?>
\ No newline at end of file
diff --git a/lib/docs/UNL_Templates/docs/examples/example1.php b/lib/docs/UNL_Templates/docs/examples/example1.php
index 912af5efdaee40a14b0598e25248c66e935fa1bd..cc5245dc39bc33cdbe4095446e1edd03b55eae32 100644
--- a/lib/docs/UNL_Templates/docs/examples/example1.php
+++ b/lib/docs/UNL_Templates/docs/examples/example1.php
@@ -5,12 +5,12 @@
  * 
  * @package UNL_Templates
  */
-
-ini_set('display_errors',true);
-error_reporting(E_STRICT);
-set_include_path(realpath(dirname(__FILE__).'/../../').PATH_SEPARATOR.realpath(dirname(__FILE__).'/../../../UNL_DWT').PATH_SEPARATOR.realpath(dirname(__FILE__).'/includes/pear/php'));
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+set_include_path(realpath(dirname(__FILE__).'/../../').PATH_SEPARATOR.realpath(dirname(__FILE__).'/../../lib/php'));
 require_once 'UNL/Templates.php';
 UNL_Templates::$options['version'] = 3;
+
 $page = UNL_Templates::factory('Fixed', array('sharedcodepath' => 'sharedcode'));
 $page->addScript('test.js');
 $page->addScriptDeclaration('function sayHello(){alert("Hello!");}');
diff --git a/lib/downloads/UNL_Templates-1.1.0.tgz b/lib/downloads/UNL_Templates-1.1.0.tgz
new file mode 100644
index 0000000000000000000000000000000000000000..83953896ef39dea33cfff04e6919e9c58bb5cba5
Binary files /dev/null and b/lib/downloads/UNL_Templates-1.1.0.tgz differ
diff --git a/lib/php/UNL/Templates.php b/lib/php/UNL/Templates.php
index 3ab6bda514cd97c98409ee867e0cce264e8d924e..46c4eabc48b2500daa20a16f99869ac325f0465f 100644
--- a/lib/php/UNL/Templates.php
+++ b/lib/php/UNL/Templates.php
@@ -61,7 +61,7 @@ class UNL_Templates extends UNL_DWT
         'sharedcodepath'         => 'sharedcode',
         'templatedependentspath' => '',
         'cache'                  => array(),
-        'version'                => self::VERSION2
+        'version'                => self::VERSION3
     );
     
     /**
@@ -77,7 +77,9 @@ class UNL_Templates extends UNL_DWT
     public function __construct()
     {
         date_default_timezone_set(date_default_timezone_get());
-        self::$options['templatedependentspath'] = $_SERVER['DOCUMENT_ROOT'];
+        if (empty(self::$options['templatedependentspath'])) {
+            self::$options['templatedependentspath'] = $_SERVER['DOCUMENT_ROOT'];
+        }
     }
     
     /**
@@ -323,9 +325,42 @@ class UNL_Templates extends UNL_DWT
     static public function getCachingService()
     {
         if (!isset(self::$cache)) {
-            include_once 'UNL/Templates/CachingService/CacheLite.php';
-            self::$cache = new UNL_Templates_CachingService_CacheLite(self::$options['cache']);
+            $file  = 'UNL/Templates/CachingService/Null.php';
+            $class = 'UNL_Templates_CachingService_Null';
+
+            $fp = @fopen('UNL/Cache/Lite.php', 'r', true);
+            if ($fp) {
+                fclose($fp);
+                $file  = 'UNL/Templates/CachingService/UNLCacheLite.php';
+                $class = 'UNL_Templates_CachingService_UNLCacheLite';
+            } else {
+                $fp = @fopen('Cache/Lite.php', 'r', true);
+                if ($fp) {
+                    fclose($fp);
+                    $file  = 'UNL/Templates/CachingService/CacheLite.php';
+                    $class = 'UNL_Templates_CachingService_CacheLite';
+                }
+            }
+
+            include_once $file;
+            self::$cache = new $class(self::$options['cache']);
         }
         return self::$cache;
     }
+
+    static public function getDataDir()
+    {
+        if ('/Library/WebServer/Documents/workspace/UNL_Elgg/lib/data' != '@DATA_DIR'.'@') {
+            // pear/pyrus installation
+            return '/Library/WebServer/Documents/workspace/UNL_Elgg/lib/data/UNL_Templates/data/';
+        }
+        
+        if (file_exists(dirname(__FILE__).'/../data/tpl_cache')) {
+            // svn checkout
+            return realpath(dirname(__FILE__).'/../data');
+        }
+
+        // new pear2 package & pyrus installation layout
+        return dirname(__FILE__).'/../../data/UNL_Templates/pear.unl.edu/data';
+    }
 }
diff --git a/lib/php/UNL/Templates/CachingService/Null.php b/lib/php/UNL/Templates/CachingService/Null.php
new file mode 100644
index 0000000000000000000000000000000000000000..6a2f16f1f528d1deee52f1f4194058012a34764b
--- /dev/null
+++ b/lib/php/UNL/Templates/CachingService/Null.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * A Null cache service that can be used for testing
+ * 
+ * PHP version 5
+ *  
+ * @category  Templates
+ * @package   UNL_Templates
+ * @author    Brett Bieber <brett.bieber@gmail.com>
+ * @author    Ned Hummel <nhummel2@unl.edu>
+ * @copyright 2009 Regents of the University of Nebraska
+ * @license   http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link      http://pear.unl.edu/
+ */
+require_once 'UNL/Templates/CachingService.php';
+class UNL_Templates_CachingService_Null implements UNL_Templates_CachingService
+{
+    
+    function clean($object = null)
+    {
+        return true;
+    }
+    
+    function save($data, $key)
+    {
+        return true;
+    }
+    
+    function get($key)
+    {
+        return false;
+    }
+}
\ No newline at end of file
diff --git a/lib/php/UNL/Templates/CachingService/UNLCacheLite.php b/lib/php/UNL/Templates/CachingService/UNLCacheLite.php
new file mode 100644
index 0000000000000000000000000000000000000000..1226c665ba63daaed4ee07e940e9e12e3880f60e
--- /dev/null
+++ b/lib/php/UNL/Templates/CachingService/UNLCacheLite.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * A Cache Service using UNL_Cache_Lite
+ * 
+ * PHP version 5
+ *  
+ * @category  Templates
+ * @package   UNL_Templates
+ * @author    Brett Bieber <brett.bieber@gmail.com>
+ * @author    Ned Hummel <nhummel2@unl.edu>
+ * @copyright 2009 Regents of the University of Nebraska
+ * @license   http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link      http://pear.unl.edu/
+ */
+require_once 'UNL/Templates/CachingService/CacheLite.php';
+class UNL_Templates_CachingService_UNLCacheLite extends UNL_Templates_CachingService_CacheLite
+{
+
+    function __construct($options = array())
+    {
+        include_once 'UNL/Cache/Lite.php';
+        $options = array_merge(array('lifeTime'=>3600), $options);
+        $this->cache = new UNL_Cache_Lite($options);
+    }
+
+}
diff --git a/lib/php/UNL/Templates/Version2.php b/lib/php/UNL/Templates/Version2.php
index e89a38f40c98e971ee7792ca2a8e281467e5c8bc..22a3a5538c5b99c6fa0592ec40632c58cbc7aa1e 100644
--- a/lib/php/UNL/Templates/Version2.php
+++ b/lib/php/UNL/Templates/Version2.php
@@ -24,7 +24,17 @@ class UNL_Templates_Version2 implements UNL_Templates_Version
     
     function getTemplate($template)
     {
-        return file_get_contents('http://pear.unl.edu/UNL/Templates/server.php?template='.$template);
+        // Always try and retrieve the latest
+        if (!(UNL_Templates::getCachingService() instanceof UNL_Templates_CachingService_Null)
+            && $tpl = file_get_contents('http://pear.unl.edu/UNL/Templates/server.php?version=2&template='.$template)) {
+            return $tpl;
+        }
+
+        if (file_exists(UNL_Templates::getDataDir().'/tpl_cache/Version2/'.$template)) {
+            return file_get_contents($template);
+        }
+
+        throw new Exception('Could not get the template file!');
     }
     
     function makeIncludeReplacements($html)
diff --git a/lib/php/UNL/Templates/Version3.php b/lib/php/UNL/Templates/Version3.php
index b55f6709aa0560dd38f824bb24c95d23086aea86..8dd1e100720f5943a17e6e5f7fa2e8483318cdb4 100644
--- a/lib/php/UNL/Templates/Version3.php
+++ b/lib/php/UNL/Templates/Version3.php
@@ -40,7 +40,18 @@ class UNL_Templates_Version3 implements UNL_Templates_Version
                                  'getTemplate', 1);
             $template = 'Absolute.tpl';
         }
-        return file_get_contents('http://pear.unl.edu/UNL/Templates/server.php?version=3&template='.$template);
+
+        // Always try and retrieve the latest
+        if (!(UNL_Templates::getCachingService() instanceof UNL_Templates_CachingService_Null)
+            && $tpl = file_get_contents('http://pear.unl.edu/UNL/Templates/server.php?version=3&template='.$template)) {
+            return $tpl;
+        }
+
+        if (file_exists(UNL_Templates::getDataDir().'/tpl_cache/Version3/'.$template)) {
+            return file_get_contents(UNL_Templates::getDataDir().'/tpl_cache/Version3/'.$template);
+        }
+
+        throw new Exception('Could not get the template file!');
     }
     
     function makeIncludeReplacements($html)
diff --git a/lib/php/UNL/Templates/Version3/Mobile.php b/lib/php/UNL/Templates/Version3/Mobile.php
new file mode 100644
index 0000000000000000000000000000000000000000..cc17d8acf1a8ecde63b76ad87df53d5e06027903
--- /dev/null
+++ b/lib/php/UNL/Templates/Version3/Mobile.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Template Definition for mobile.dwt
+ * 
+ * PHP version 5
+ *  
+ * @category  Templates
+ * @package   UNL_Templates
+ * @author    Kyle Powers <kylepowers@gmail.com>
+ * @license   http://www1.unl.edu/wdn/wiki/Software_License BSD License
+ * @link      http://pear.unl.edu/
+ */
+require_once 'UNL/Templates.php';
+
+class UNL_Templates_Version3_Mobile extends UNL_Templates 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__template = 'Mobile.tpl';                       // template name
+    public $doctitle = "<title>UNL | Department | New Page</title>";                       // string()  
+    public $head = "<!-- Place optional header elements here -->";                           // string()  
+    public $titlegraphic = "<h1>Department</h1>";                   // string()  
+    public $pagetitle = "";                      // string()  
+    public $maincontentarea = "<p>Place your content here.<br /> Remember to validate your pages before publishing! Sample layouts are available through the <a href=\"http://wdn.unl.edu//\">Web Developer Network</a>. <br /> <a href=\"http://validator.unl.edu/check/referer\">Check this page</a> </p>";                // string()  
+    public $footercontent = "<!--#include virtual=\"../sharedcode/footer.html\" -->";                  // string()  
+
+    /* Static get */
+    function staticGet($k,$v=NULL) { return UNL_DWT::staticGet('UNL_Templates_Version3_Mobile',$k,$v); }
+
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+}