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 function navbar($data = '', $current = '') { $html = array(); if (!is_array($data)) { $data = $this->data['navbar']; } if (is_array($data)) { $current = empty($current) ? $this->data['navbar.current'] : $current; $current = empty($current) ? application::action() : $current; $current = empty($current) ? $data[0]['id'] : $current; $html[] = ''; $html[] = '<div class="navbar">'; $html[] = ' <ul>'; foreach ($data as $item) { if (is_array($item)) { $class = $current == $item['id'] ? 'current' : (empty($item['href']) ? 'hidden' : 'normal'); $href = empty($item['href']) ? '#' : $item['href']; $html[] = ' <li class="' . $item['class'] . ' ' . $class . '"><a href="' . $href . '" id="' . $item['id'] . '"><span>' . $item['title'] . '</span></a></li>'; } else { $html[] = ' <li class="' . $item['class'] . ' ' . $class . '">' . $item . '</li>'; } } $html[] = ' </ul>'; $html[] = '</div>'; } echo implode("\n", $html); }
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; }