Index: branches/beta/data/class/SC_View.php
===================================================================
--- branches/beta/data/class/SC_View.php	(revision 16239)
+++ branches/beta/data/class/SC_View.php	(revision 16338)
@@ -20,4 +20,6 @@
     /** »ÈÍÑ¤·¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥Ã¥±¡¼¥¸Ì¾ */
     var $tplName;
+    /** display¤¹¤ëtpl¥Õ¥¡¥¤¥ëÌ¾ */
+    var $template;
 
     /**
@@ -77,5 +79,5 @@
         $this->_smarty->register_function("sfIsHTTPS","sfIsHTTPS");
         $this->_smarty->default_modifiers = array('script_escape');
-        $this->_smarty->force_compile = true;
+        $this->_smarty->force_compile = DEBUG_MODE;
     }
 
@@ -113,12 +115,12 @@
         if (!defined('LOAD_SITEINFO')) {
             $this->objSiteInfo = new SC_SiteInfo();
-            $arrInfo['arrSiteInfo'] = $this->objSiteInfo->data;
+            $arrSiteInfo = $this->objSiteInfo->data;
 
             // ÅÔÆ»ÉÜ¸©Ì¾¤òÊÑ´¹
             global $arrPref;
-            $arrInfo['arrSiteInfo']['pref'] = $arrPref[$arrInfo['arrSiteInfo']['pref']];
+            $arrSiteInfo['pref'] = $arrPref[$arrSiteInfo['pref']];
 
             // ¥µ¥¤¥È¾ðÊó¤ò³ä¤êÅö¤Æ¤ë
-            $this->assignArray($arrInfo);
+            $this->assign('arrSiteInfo', $arrSiteInfo);
 
             define('LOAD_SITEINFO', 1);
@@ -154,6 +156,8 @@
      */
     function display($template, $display = false) {
+        $this->template = $template;
+
         // ¥Æ¥ó¥×¥ì¡¼¥ÈÀÚ¤êÂØ¤¨½èÍý
-        $this->initDisplay($template);
+        $this->initTemplate();
 
         // ¥°¥í¡¼¥Ð¥ë¥¨¥é¡¼¤ÎÉ½¼¨
@@ -161,5 +165,5 @@
 
         // ²èÌÌÉ½¼¨
-        $this->_smarty->display($template);
+        $this->_smarty->display($this->template);
 
         // ¥Ù¥ó¥Á¥Þ¡¼¥¯·ë²Ì¤ÎÉ½¼¨
@@ -171,5 +175,5 @@
      *  ¼ÂÁõ¤Ï»Ò¥¯¥é¥¹¤Ç¹Ô¤¦.
      */
-    function initDisplay($template) {}
+    function initTemplate() {}
 
     /**
@@ -276,9 +280,19 @@
     }
 
-    function initDisplay($template) {
+    function initTemplate() {
         // ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ïreturn
         if (empty($this->tplName)) return;
 
+        // ¸½ºß»ÈÍÑ¤·¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥Ã¥±¡¼¥¸¤Î¥Ñ¥¹
+        // ***/html/user_data/tpl_packages/***/templates/
+        $template_dir = TPL_PKG_PATH . $this->tplName . '/templates/';
+        // FIXME ¤³¤³¤Ë¥â¥Ð¥¤¥ëÍÑ½èÍý¤ò¶´¤ß¤¿¤¯¤Ê¤¤...
+        if (defined('MOBILE_TEMPLATE_DIR') && $this->_smarty->template_dir == MOBILE_TEMPLATE_DIR) {
+            $template_dir .= 'mobile/';
+        }
+
         /**
+         * tpl_mainpage¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÅ¬±þ½èÍý
+         *
          * tpl_mainpage¤¬ÁêÂÐ¥Ñ¥¹¤Ç¤¢¤ì¤Ð
          * ¥æ¡¼¥¶¡¼¥Æ¥ó¥×¥ì¡¼¥È¤Ø¤ÎÀäÂÐ¥Ñ¥¹¤ËÊÑ¹¹¤·
@@ -286,10 +300,10 @@
          */
         $tpl_mainpage  = $this->_smarty->get_template_vars('tpl_mainpage');
-        $template_dir = TPL_PKG_PATH . $this->tplName . '/templates/';
 
         $win = "^[a-zA-Z]{1}:";
         $other = "^\/";
         $pattern = "/($win)|($other)/";
-        if (!preg_match($pattern, $tpl_mainpage)) {
+
+        if (!is_null($tpl_mainpage) && !preg_match($pattern, $tpl_mainpage)) {
             $tpl_pkg_mainpage = $template_dir . $tpl_mainpage;
             if (file_exists($tpl_pkg_mainpage)) {
@@ -297,4 +311,19 @@
             }
         }
+
+        // site_frame.tpl¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÅ¬ÍÑ½èÍý
+        if ($this->template == SITE_FRAME) {
+            if(file_exists($template_dir . SITE_FRAME)) {
+                $this->template = $template_dir . SITE_FRAME;
+            }
+        // $this->template¤¬SITE_FRAME¤Ç¤Ê¤¤¾ì¹ç
+        // $objView->display($objPage->tpl_mainpage)¤Ê¤É
+        } else {
+            if(file_exists($template_dir . $this->template)) {
+                $this->template = $template_dir . $this->template;
+            }
+        }
+
+        // site_main.tpl¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÅ¬±þ½èÍý
         $tpl_site_main = $template_dir . 'site_main.tpl';
         if (file_exists($tpl_site_main)) {
@@ -302,5 +331,12 @@
         }
     }
-}
+
+    function fetch($template) {
+        $this->template = $template;
+        $this->initTemplate();
+        return $this->_smarty->fetch($this->template);
+    }
+}
+
 class SC_UserView extends SC_SiteView{
     function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) {
@@ -321,4 +357,5 @@
         $this->_smarty->compile_dir = $compile_dir;
     }
+    // SC_View::getTemplateName()¤ÎDB¥¢¥¯¥»¥¹½èÍý¤ò¹Ô¤ï¤Ê¤¤¤è¤¦¤Ë¥ª¡¼¥Ð¡¼¥é¥¤¥É
     function getTemplateName() {}
 }
@@ -331,4 +368,3 @@
     }
 }
-
 ?>
