예제 #1
0
파일: core.php 프로젝트: noikiy/mygit
 public function template($filename, $type = TEMPLATE_INCLUDEPATH)
 {
     global $_W;
     $name = strtolower($this->modulename);
     if (defined('IN_SYS')) {
         $source = IA_ROOT . "/web/themes/{$_W['template']}/{$name}/{$filename}.html";
         $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$name}/{$filename}.tpl.php";
         if (!is_file($source)) {
             $source = IA_ROOT . "/web/themes/default/{$name}/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/addons/{$name}/template/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/web/themes/default/{$filename}.html";
         }
         if (!is_file($source)) {
             $explode = explode('/', $filename);
             $temp = array_slice($explode, 1);
             $source = IA_ROOT . "/addons/{$name}/plugin/" . $explode[0] . "/template/" . implode('/', $temp) . ".html";
         }
     } else {
         $template = "default";
         $file = IA_ROOT . "/addons/ewei_shop/data/template/shop_" . $_W['uniacid'];
         if (is_file($file)) {
             $template = file_get_contents($file);
             if (!is_dir(IA_ROOT . '/addons/ewei_shop/template/mobile/' . $template)) {
                 $template = "default";
             }
         }
         $compile = IA_ROOT . "/data/tpl/app/ewei_shop/{$template}/mobile/{$filename}.tpl.php";
         $source = IA_ROOT . "/addons/{$name}/template/mobile/{$template}/{$filename}.html";
         if (!is_file($source)) {
             $source = IA_ROOT . "/addons/{$name}/template/mobile/default/{$filename}.html";
         }
         if (!is_file($source)) {
             $names = explode('/', $filename);
             $pluginname = $names[0];
             $ptemplate = "default";
             $file = IA_ROOT . "/addons/ewei_shop/data/template/plugin_" . $pluginname . "_" . $_W['uniacid'];
             if (is_file($file)) {
                 $template = file_get_contents($file);
                 if (!is_dir(IA_ROOT . '/addons/ewei_shop/plugin/' . $pluginname . "/template/mobile/" . $ptemplate)) {
                     $ptemplate = "default";
                 }
             }
             $pfilename = $names[1];
             $source = IA_ROOT . "/addons/ewei_shop/plugin/" . $pluginname . "/template/mobile/" . $ptemplate . "/{$pfilename}.html";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/app/themes/{$_W['template']}/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/app/themes/default/{$filename}.html";
         }
     }
     if (!is_file($source)) {
         exit("Error: template source '{$filename}' is not exist!");
     }
     if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
         shop_template_compile($source, $compile, true);
     }
     return $compile;
 }
예제 #2
0
파일: plugin.php 프로젝트: ChainBoy/wxfx
 public function template($filename, $type = TEMPLATE_INCLUDEPATH)
 {
     global $_W;
     $defineDir = IA_ROOT . "/addons/ewei_shop/";
     if (defined('IN_SYS')) {
         $source = IA_ROOT . "/addons/ewei_shop/plugin/" . $this->pluginname . "/template/{$filename}.html";
         $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/ewei_shop/plugin/" . $this->pluginname . "/{$filename}.tpl.php";
         if (!is_file($source)) {
             $source = IA_ROOT . "/addons/ewei_shop/template/{$filename}.html";
             $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/ewei_shop/{$filename}.tpl.php";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html";
             $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$filename}.tpl.php";
         }
         if (!is_file($source)) {
             $source = IA_ROOT . "/web/themes/default/{$filename}.html";
             $compile = IA_ROOT . "/data/tpl/web/default/{$filename}.tpl.php";
         }
     } else {
         $global_template = "default";
         $file = IA_ROOT . "/addons/ewei_shop/data/template/shop_" . $_W['uniacid'];
         if (is_file($file)) {
             $global_template = file_get_contents($file);
             if (!is_dir(IA_ROOT . '/addons/ewei_shop/template/mobile/' . $template)) {
                 $global_template = "default";
             }
         }
         $template = "default";
         $file = IA_ROOT . "/addons/ewei_shop/data/template/plugin_" . $this->pluginname . "_" . $_W['uniacid'];
         if (is_file($file)) {
             $template = file_get_contents($file);
             if (!is_dir(IA_ROOT . '/addons/ewei_shop/plugin/' . $this->pluginname . "/template/mobile/" . $template)) {
                 $template = "default";
             }
         }
         $compile = IA_ROOT . "/data/tpl/app/ewei_shop/plugin/" . $this->pluginname . "/{$template}/mobile/{$filename}.tpl.php";
         $source = $defineDir . "/plugin/" . $this->pluginname . "/template/mobile/{$template}/{$filename}.html";
         if (!is_file($source)) {
             $source = $defineDir . "/plugin/" . $this->pluginname . "/template/mobile/default/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = $defineDir . "/template/mobile/{$global_template}/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = $defineDir . "/template/mobile/default/{$filename}.html";
         }
         if (!is_file($source)) {
             $source = $defineDir . "/template/mobile/{$filename}.html";
         }
     }
     if (!is_file($source)) {
         exit("Error: template source '{$filename}' is not exist!");
     }
     if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
         shop_template_compile($source, $compile, true);
     }
     return $compile;
 }