public function template($path = '') { $path = trim($path, '/'); if (empty($path)) { $path = application::module() . '/' . application::controller() . '/' . application::action() . '.php'; } $template = ZOTOP_PATH_THEMES . DS . application::theme() . DS . 'template' . DS . str_replace('/', DS, $path); return $template; }
/** * 应用程序启动 * */ public static function boot() { //app define('ZOTOP_APP_URL_THEME', ZOTOP_APP_URL . '/themes/' . application::theme()); define('ZOTOP_APP_URL_COMMON', ZOTOP_APP_URL . '/common'); define('ZOTOP_APP_URL_CSS', ZOTOP_APP_URL_THEME . '/css'); define('ZOTOP_APP_URL_IMAGE', ZOTOP_APP_URL_THEME . '/image'); define('ZOTOP_APP_URL_JS', ZOTOP_APP_URL_COMMON . '/js'); //group define('ZOTOP_GROUP', application::group()); //module define('ZOTOP_MODULE', application::module()); define('ZOTOP_MODULE_URL', zotop::modules(ZOTOP_MODULE, 'url')); define('ZOTOP_MODULE_URL_GROUP', ZOTOP_MODULE_URL . '/' . ZOTOP_GROUP); define('ZOTOP_MODULE_PATH', zotop::modules(ZOTOP_MODULE, 'path')); define('ZOTOP_MODULE_PATH_GROUP', ZOTOP_MODULE_PATH . DS . ZOTOP_GROUP); //controller define('ZOTOP_CONTROLLER', application::controller()); //action define('ZOTOP_ACTION', application::action()); }
public static function template($namespace = '') { if (empty($namespace)) { $namespace = application::module() . '/' . application::controller() . '/' . application::action(); } $namespace = str_replace('.', '/', $namespace); $namespaces = explode('/', $namespace); switch (count($namespaces)) { case 1: $module = application::module(); $namespace = $namespaces[0]; break; default: $module = array_shift($namespaces); $namespace = implode('/', $namespaces); break; } $template = zotop::module($module, 'path') . DS . ZOTOP_APPLICATION . DS . 'template' . DS . str_replace('/', DS, $namespace) . '.php'; return $template; }