function handle()
 {
     if (isset($_GET['behav'])) {
         if ($_GET['behav'] == 'uploadimg') {
             $name = uniqid() . '.jpg';
             move_uploaded_file($_FILES["pic"]["tmp_name"], './jae/' . $name);
             upoadTmpFile('./jae/' . $name);
             $tmp = array();
             $tmp['url'] = getTmpFileUrl($name);
             $tmp['id'] = $name;
             echo json_encode($tmp);
             exit;
         }
     }
     $smarty = new Smarty();
     $smarty->assign('logined', isLogined());
     $smarty->display('libs/view/head.ctp');
     if (isset($_POST['bookname'])) {
         $name = explode('.', $_FILES["file"]["name"]);
         $name = $name[count($name) - 1];
         if ($name == 'mobi') {
             $id = $this->doUpload();
             header("location:index.php?action=detail&bid={$id}");
             //$smarty->assign('type','success');
             //$smarty->assign('message','上传成功');
         } else {
             $smarty->assign('type', 'error');
             $smarty->assign('message', '上传失败,文件类型错误');
         }
         //$smarty->display('libs/view/alert.ctp');
     }
     $smarty->display('libs/view/upload.ctp');
     $smarty->display('libs/view/tail.ctp');
 }
示例#2
0
 function handle()
 {
     $db = new db();
     if (isset($_GET['action2']) == 'checkemail') {
         if (isset($_GET['email'])) {
             echo $db->checkEmail($_GET['email']);
         } else {
             header('location:index.php');
         }
         exit;
     }
     if (isset($_SESSION['email'])) {
         header('location:index.php');
     }
     if (!isset($_POST['email']) || !isset($_POST['pwd'])) {
         $smarty = new Smarty();
         $smarty->assign('logined', isLogined());
         $smarty->display('libs/view/head.ctp');
         $smarty->display('libs/view/reg.ctp');
         $smarty->display('libs/view/tail.ctp');
         exit;
     }
     $email = $_POST['email'];
     $pwd = $_POST['pwd'];
     if ($db->addUsr($email, $pwd)) {
         $_SESSION['email'] = $email;
         $_SESSION['pwd'] = $pwdl;
     }
     header('location:index.php');
 }
示例#3
0
 public function display($name, $tpl_vars = array())
 {
     //die(var_dump($name));
     if (!empty($tpl_vars)) {
         $this->assign($tpl_vars);
     }
     echo $this->_smarty->display($name);
 }
示例#4
0
 /**
  * Render template
  */
 public function _run()
 {
     foreach ($this->getVars() as $key => $val) {
         $this->smarty->assign($key, $val);
     }
     $this->smarty->assign('view', $this);
     $this->smarty->assign('gimme', $this->smarty->context());
     $file = array_shift(func_get_args());
     $this->smarty->display($file);
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 public function render($viewFile, $withViewSuffix = false, array $data = array())
 {
     $viewFile = $this->getViewFileWithViewRoot($viewFile, $withViewSuffix);
     // assin variable
     foreach ($data as $key => $value) {
         $this->assign($key, $value);
     }
     ob_start();
     $this->smarty->display($viewFile);
     return ob_get_clean();
 }
示例#6
0
 /**
  * Render the actual view file.
  *
  * @param string $p_sTplFile The template to load up. For example the master template.
  * @throws PPI_Exception
  * @return void
  */
 function render($p_sTplFile)
 {
     // Optional extension for smarty templates
     $p_sTplFile = PPI_Helper::checkExtension($p_sTplFile, SMARTY_EXT);
     $sTheme = PPI_Helper::getConfig()->layout->view_theme;
     $sPath = $this->_viewPath . "{$sTheme}/{$p_sTplFile}";
     if (!file_exists($sPath)) {
         throw new PPI_Exception('Unable to load: ' . $sPath . ' file does not exist');
     }
     $this->_renderer->display($sPath);
 }
 public function render($action)
 {
     if ($this->doRender) {
         $templateFile = "view/" . $this->getControllerName() . "/" . lcfirst($action) . ".tpl";
         if (!is_file($templateFile)) {
             echo "Error: No such file: {$templateFile}";
             exit;
         }
         $this->smarty->display($templateFile);
     }
 }
 /**
  * 
  * @param string $word
  */
 private function AjaxTaskTwo($word)
 {
     $smarty = new Smarty();
     $morphy = new Morphy($word);
     $r = $morphy->process();
     if ($r) {
         $smarty->assign('result', $morphy->GetWordOut());
         $smarty->display($_SERVER['DOCUMENT_ROOT'] . 'view/resultTaskTwo.tpl');
     } else {
         $smarty->display($_SERVER['DOCUMENT_ROOT'] . 'view/errorTaskTwo.tpl');
     }
 }
示例#9
0
 /**
  * Implement _run() method
  *
  * The method _run() is the only method that needs to be implemented in any subclass of Zend_View_Abstract. It is called automatically within the render() method. My implementation just uses the display() method from Smarty to generate and output the template.
  *
  * @param string $template
  */
 protected function _run()
 {
     $file = func_num_args() > 0 && file_exists(func_get_arg(0)) ? func_get_arg(0) : '';
     if ($this->_customTemplate || $file) {
         $template = $this->_customTemplate;
         if (!$template) {
             $template = $file;
         }
         $this->_smarty->display($template);
     } else {
         throw new Zend_View_Exception('Cannot render view without any template being assigned or file does not exist');
     }
 }
示例#10
0
 /**
  * Renders a page of $template
  * @param $displayName
  * @param $template
  */
 function render($displayName, $template)
 {
     //If we've already rendered this page, don't render it again
     if (!$this->rendered) {
         $this->website->assign("self", $_SERVER['REQUEST_URI']);
         $this->website->assign("displayName", $displayName);
         $this->website->assign("menu", $this->menu);
         $this->website->assign("breadcrumbs", $this->breadcrumbs);
         $this->website->display($template);
         $this->db->close();
         $this->rendered = true;
     }
 }
示例#11
0
 /**
  * Display the data through Smarty
  *
  * @param array $view The template to use
  * @param array $data The data to be used in the template
  * @return void
  */
 public function runDisplay($view, $data)
 {
     $this->smarty->assign($data);
     $this->smarty->assign('input', ASO_Input::filterInput());
     $this->smarty->assign('sess', ASO_Registry('sess'));
     // GZip compression
     //ob_start( 'ob_gzhandler' );
     if (file_exists('app/views/global.tpl') && $view != 'error' && $view != '404') {
         $this->smarty->assign('templatefile', $view . '.tpl');
         $this->smarty->display('global.tpl');
     } else {
         $this->smarty->display($view . '.tpl');
     }
 }
示例#12
0
 /**
  * Render using Smarty. Picks a view called similar to controller's name
  * @param string $view A custom view
  */
 public function __render($view = False)
 {
     $smarty = new Smarty();
     $smarty->template_dir = ROOT . DS . 'app' . DS . 'views';
     $smarty->compile_dir = ROOT . DS . 'app' . DS . 'views_c';
     $smarty->cache_dir = ROOT . DS . 'cache';
     foreach ($this->data as $key => $value) {
         $smarty->assign($key, $value);
     }
     if ($view) {
         $smarty->display($view . '.tpl');
     } else {
         $smarty->display($this->name . '.tpl');
     }
 }
示例#13
0
 public function view($resource_name, $cache_id = null)
 {
     if (strpos($resource_name, '.') === false) {
         $resource_name .= '.tpl';
     }
     return parent::display($resource_name, $cache_id);
 }
示例#14
0
 /**
  * Load View.
  * 
  * @param   string      $file
  * @param   array       $data
  * @param   boolean     $return
  * @return  string
  */
 private function loadView($file, $data = array(), $return = FALSE)
 {
     ob_start();
     if (file_exists($file) || file_exists(PUBLIC_DIR . $file)) {
         # Preventing $data of this method to be passed to view.
         $__data = $data;
         unset($data);
         # Merging with already added data to class property.
         $___data = array_merge($this->view_data, $__data);
         if ($this->is_smarty) {
             $this->enableSmarty();
             foreach ($___data as $key => $value) {
                 $this->smarty->assign($key, $value);
             }
             $this->smarty->display($file);
         } else {
             extract($___data);
             # Now we don't want __data and ___data.
             unset($__data, $___data);
             include $file;
         }
     }
     # Setting flag off.
     $this->is_smarty = FALSE;
     # Returning view if requested to return.
     if ($return === TRUE) {
         $content = ob_get_contents();
         ob_end_clean();
         return $content;
     }
 }
 /**
  * 重写display函数,给矛默认值
  *
  * @param String $resourceName
  * @param int $cacheId
  * @param int $complieId
  */
 public function display($resourceName = null, $cacheId = null, $complieId = null)
 {
     if (!$resourceName) {
         $resourceName = "{$_GET['c']}/{$_GET['a']}." . TEMPLATE_TYPE;
     }
     parent::display($resourceName, $cacheId, $complieId);
 }
示例#16
0
 /**
  * Оказва кой темплейт да се зареди и коя е мастър страницата
  * 
  * За нормални страници се използва index.tpl като мастър страница,
  * в него си има логика, за да зареди посочения темплейт
  * 
  * Когато трябва да се връща резултат от ajax заявки като мастър
  * страница трябва да се изпозлва master_ajax.tpl. Тук има два
  * случая:
  *  - връщане на данни като json и подобни - за темплейт се задава
  *  	ajax_data.tpl, който връща това което е подадено на променливата 
  *  	ajax_data
  *  - връщане на html - задава се темплейтът, който ще генерира съответния html
  * 
  * @param string $template
  * @param string $master
  */
 function display($template = false, $master = 'index.tpl')
 {
     $xhr = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
     if ($xhr) {
         $master = 'ajax.tpl';
     }
     if ($template) {
         $this->smarty->assign('template', $template);
     } else {
         $this->smarty->assign('template', get_class($this) . '/index.tpl');
     }
     //проверка на браузъра - за Imperavi Redactor
     $browser = preg_match('/(?i)msie [1-8]/', $_SERVER['HTTP_USER_AGENT']);
     $this->smarty->assign('browser', $browser == 1 ? '8' : '');
     $this->smarty->display($master);
 }
示例#17
0
 public function Display($file = false, $echo = true)
 {
     global $CMS, $DB, $USER;
     $smarty = new Smarty();
     //set cache and compile dir
     $smarty->setCacheDir("./data/data__hoang_taka_com/cache/");
     $smarty->setCompileDir("./data/data__hoang_taka_com/template_c/");
     $smarty->force_compile = $this->force_compile;
     $smarty->debugging = $this->debugging;
     $smarty->caching = $this->caching;
     $smarty->cache_lifetime = $this->cache_lifetime;
     if ($file) {
         //check template website use.
         $file_dir = "themes/" . $file . ".tpl";
         if (is_file($file_dir)) {
             $smarty->assign($this->data);
             if ($echo) {
                 return $smarty->display($file_dir);
             } else {
                 return $smarty->fetch($file_dir);
             }
         } else {
             echo "File: <b>{$file_dir}</b> is missing.";
         }
     }
 }
示例#18
0
 function _renderForm(&$page)
 {
     $pageName = $page->getAttribute('name');
     $tabPreview = array_slice($page->controller->_tabs, -2, 1);
     // setup a template object
     $tpl = new Smarty();
     $tpl->template_dir = './templates';
     $tpl->compile_dir = './templates_c';
     // on preview tab, add progress bar javascript and stylesheet
     if ($pageName == $tabPreview[0][0]) {
         $bar = $page->controller->createProgressBar();
         $tpl->assign(array('qf_style' => $bar->getStyle(), 'qf_script' => $bar->getScript()));
         $barElement = $page->getElement('progressBar');
         $barElement->setText($bar->toHtml());
     }
     $renderer = new HTML_QuickForm_Renderer_Array(true);
     $page->accept($renderer);
     $tpl->assign('form', $renderer->toArray());
     // capture the array stucture
     // (only for showing in sample template)
     ob_start();
     print_r($renderer->toArray());
     $tpl->assign('dynamic_array', ob_get_contents());
     ob_end_clean();
     $tpl->display('smarty-dynamic.tpl');
 }
示例#19
0
 public function GenOutput()
 {
     $this->tables = array();
     foreach ($this->codeGenerator->getClasses() as $class) {
         $columns = array();
         if ($class->hasChild()) {
             foreach ($class->getChildElements() as $element) {
                 if ($element->getType() == Type::PropertyElement) {
                     $columnText = $element->getAttribute(self::Column);
                     if ($columnText != null) {
                         $column = $this->getColumnParams(substr($columnText, 1, -1));
                         $column['name'] = $element->getName();
                         $columns[] = $column;
                     }
                 }
             }
             if (count($columns) > 0) {
                 $this->tables[$class->getName()] = array("name" => $class->getName(), "columns" => $columns);
             }
         }
     }
     $smarty = new \Smarty();
     // $smarty->caching = false;
     $smarty->assign("tables", $this->tables);
     $smarty->display(__DIR__ . '/database.tpl');
 }
示例#20
0
文件: joinus.php 项目: ECP-Black/ECP
function admin_joinus()
{
    global $db, $countries;
    $tpl = new smarty();
    $db->query('SELECT tname, `joinID`, `name`, b.username, b.email, b.icq, b.msn, `age`, b.country, `teamID`, `comment`, `IP`, `datum`, `closed`, `closedby`, a.username as closedby_username FROM ' . DB_PRE . 'ecp_joinus as b LEFT JOIN ' . DB_PRE . 'ecp_teams ON (teamID = tID) LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (ID=closedby) ORDER BY closed ASC, datum ASC');
    $joinus = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(SHORT_DATE, $row['datum']);
        if ($row['joinID'] == (int) @$_GET['id']) {
            $spe = $row;
        }
        $joinus[] = $row;
    }
    if (@$spe) {
        ob_start();
        $tpl1 = new Smarty();
        foreach ($spe as $key => $value) {
            $tpl1->assign($key, $value);
        }
        $tpl1->assign('countryname', $countries[$spe['country']]);
        $tpl1->assign('id', $row['joinID']);
        $tpl1->display(DESIGN . '/tpl/admin/joinus_view.html');
        $tpl->assign('details', ob_get_contents());
        ob_end_clean();
    }
    $tpl->assign('joinus', $joinus);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/joinus.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(JOINUS, $content, '', 1);
}
示例#21
0
 function bind()
 {
     //page vars
     $form_action = $_SERVER['PHP_SELF'];
     $this->onloadscript = "setFocus('txtEmail');";
     //smarty
     $smarty = new Smarty();
     $smarty->force_compile = true;
     $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
     $smarty->assign("stats", stats::get_stats());
     $smarty->assign("menu_item", "signup");
     $smarty->assign("postcode", $this->postcode);
     $smarty->assign("email", $this->email);
     $smarty->assign("alert_area_size", $this->alert_area_size);
     $smarty->assign("page_title", "Email alerts of planning applications near you");
     $smarty->assign("warnings", $this->warnings);
     $smarty->assign("email_warn", $this->email_warn);
     $smarty->assign("postcode_warn", $this->postcode_warn);
     $smarty->assign("onloadscript", $this->onloadscript);
     $smarty->assign("small_zone_size", SMALL_ZONE_SIZE);
     $smarty->assign("medium_zone_size", MEDIUM_ZONE_SIZE);
     $smarty->assign("large_zone_size", LARGE_ZONE_SIZE);
     //Render
     $smarty->display('index.tpl');
 }
示例#22
0
 /**
  * Initialisiert den Seiteninhalt
  *
  */
 private function _initPage()
 {
     //**Template-Set einstellen und für die Templates als Variable zugänglich machen
     $this->_smarty_array['TEMPLATESET_DIR'] = TEMPLATESET_DIR;
     $this->_tplfile = 'index.tpl';
     if ($this->_is_admin == true) {
         $table = 'admin_menu';
         $shortlink = ADMIN_MENU_USE_SHORTLINKS;
     } else {
         $table = 'menu';
         $shortlink = USER_MENU_USE_SHORTLINKS;
     }
     $this->_loadNav($shortlink);
     $this->_check_spec_action();
     $this->_mysql->query("SELECT `menu_pagetyp`, `menu_page`,  `menu_name` FROM `{$table}` WHERE `menu_ID`= '{$this->_nav_id}'");
     $page_data = $this->_mysql->fetcharray("assoc");
     $page_id = (int) $page_data['menu_page'];
     // erste Variablen abspeichern, damit sie in den Modulen aufgerufen werden können
     $this->_smarty->assign($this->_smarty_array);
     $this->_smarty_array = array();
     if ($page_data['menu_pagetyp'] == 'mod') {
         $this->_loadModule($page_id, $page_data);
     } elseif ($page_data['menu_pagetyp'] == 'pag') {
         $this->_loadContent($page_id, $page_data);
     } else {
         throw new CMSException(array('core' => 'modul_not_found'), null, "", array('core' => 'modul_load_error'));
     }
     $this->_smarty_array['shortlink'] = $shortlink;
     $this->_smarty_array['generated_time'] = round((double) (microtime(true) - START_TIME), 5);
     $this->_smarty->assign($this->_smarty_array);
     $this->_smarty->display($this->_tplfile);
 }
示例#23
0
 function view($template_name)
 {
     if (strpos($template_name, '.') === FALSE && strpos($template_name, ':') === FALSE) {
         $template_name .= '.tpl';
     }
     parent::display($template_name);
 }
示例#24
0
 function display($resource_name = null, $cache_id = null, $compile_id = null)
 {
     if (is_null($resource_name)) {
         $resource_name = "{$_GET["m"]}/{$_GET["a"]}" . C('TPL_SUFFIX');
     } else {
         if (strstr($resource_name, "/")) {
             $resource_name = $resource_name . C('TPL_SUFFIX');
         } else {
             $resource_name = $_GET["m"] . "/" . $resource_name . C('TPL_SUFFIX');
         }
     }
     $tplpath = rtrim(C('TPL_DIR'), '/') . '/' . $resource_name;
     if (!file_exists($tplpath)) {
         if (C('DEBUG')) {
             Debug::addmsg("<font style='color:red'>当前访问的模板文件:  {$tplpath} 不存在</font>");
         } else {
             $this->error('抱歉, 访问的页面不存在!');
         }
     } else {
         if (C('DEBUG')) {
             Debug::addmsg("当前访问的模板文件: {$tplpath}");
         }
         //预定义目录
         $root = rtrim(substr(C('PRO_PATH'), strlen(rtrim($_SERVER["DOCUMENT_ROOT"], "/\\"))), '/\\');
         $resource = rtrim(dirname($_SERVER["SCRIPT_NAME"]), "/\\") . '/' . ltrim(C('APP_PATH'), './') . "/View/" . C('TPL_STYLE') . "/Resource/";
         $url = $_SERVER['SCRIPT_NAME'] . '/' . $_GET['m'];
         $this->assign('root', $root);
         $this->assign('public', $root . '/Public');
         $this->assign('res', $resource);
         $this->assign('url', $url);
         parent::display($resource_name, $cache_id, $compile_id);
     }
 }
示例#25
0
文件: page.php 项目: glzaboy/fastlib
 /**
  * executes & displays the template results
  *
  * 是否压缩传输默认是开启的,最终还是取决于浏览器和服务器
  *
  * @param $template string
  *            模板文件名
  * @param $return bool
  *            是否返回到php变量
  */
 public function render($tplvar = array(), $template = null)
 {
     header('content-type:text/html;charset=utf-8');
     if ($template == null) {
         $template = FL_PAGE_MOD . '/' . FL_PAGE_ACT;
     }
     $template .= '.html';
     $smarty = new \Smarty();
     $smarty->allow_php_templates = true;
     $smarty->left_delimiter = '{';
     $smarty->right_delimiter = '}';
     // $this->addPluginsDir ( __FASTLIB__ . FastLoad::getplatform ( true ) .
     // '/smarty_plug' ); // 加入PLUG目录
     $smarty->setTemplateDir(FL_PAGE_DIR . '/templates');
     $smarty->setCompileDir(FL_TMP . '/templates_c/' . FL_PAGE_DIR . '/compile');
     $smarty->assign($tplvar);
     // $this->registerFilter ( 'pre', create_function ( '$tplString',
     // 'return strtr($tplString,array(\'<!--{\'=>\'{\',\'}-->\'=>\'}\'));' )
     // );
     // $this->registerFilter ( 'pre', create_function ( '$tplString',
     // 'return
     // preg_replace_callback("/\{{$delimiter}[^\{$delimiter}]+{$delimiter}\}/",
     // array(fasttpl,gettextCompiler), $tplString);' ) );
     if (FL_DEBUG) {
         $smarty->compile_check = true;
         $smarty->caching = false;
     } else {
         $smarty->compile_check = false;
         $smarty->caching = false;
         $smarty->merge_compiled_includes = true;
     }
     $smarty->display($template);
 }
示例#26
0
 /**
  * Get the evaluated contents of the view.
  *
  * @param  string $path
  * @param  array  $data
  *
  * @throws \Exception
  * @return string
  */
 public function get($path, array $data = array())
 {
     ob_start();
     try {
         $smarty = new \Smarty();
         $smarty->caching = $this->config->get('smarty-view::caching');
         $smarty->debugging = $this->config->get('smarty-view::debugging');
         $smarty->cache_lifetime = $this->config->get('smarty-view::cache_lifetime');
         $smarty->compile_check = $this->config->get('smarty-view::compile_check');
         $smarty->error_reporting = $this->config->get('smarty-view::error_reporting');
         if (\App::environment('local')) {
             $smarty->force_compile = true;
         }
         $smarty->setTemplateDir($this->config->get('smarty-view::template_dir'));
         $smarty->setCompileDir($this->config->get('smarty-view::compile_dir'));
         $smarty->setCacheDir($this->config->get('smarty-view::cache_dir'));
         $smarty->registerResource('view', new ViewResource());
         $smarty->addPluginsDir(__DIR__ . '/plugins');
         foreach ((array) $this->config->get('smarty-view::plugins_path', array()) as $pluginPath) {
             $smarty->addPluginsDir($pluginPath);
         }
         foreach ($data as $key => $value) {
             $smarty->assign($key, $value);
         }
         $smarty->display($path);
     } catch (\Exception $e) {
         ob_get_clean();
         throw $e;
     }
     return ltrim(ob_get_clean());
 }
示例#27
0
 /**
  * 显示登录页(默认Action)
  */
 function doDefault()
 {
     $base = dirname(__FILE__);
     // 初始化smarty
     import('smarty.Smarty');
     $smarty = new Smarty();
     $smarty->template_dir = $this->app->cfg['smarty']['template_dir'];
     $smarty->compile_dir = $this->app->cfg['smarty']['compile_dir'];
     $smarty->config_dir = $this->app->cfg['smarty']['config_dir'];
     $smarty->cache_dir = $this->app->cfg['smarty']['cache_dir'];
     $smarty->debugging = $this->app->cfg['smarty']['debugging'];
     $smarty->caching = $this->app->cfg['smarty']['caching'];
     $smarty->cache_lifetime = $this->app->cfg['smarty']['cache_lifetime'];
     $smarty->left_delimiter = '{<';
     $smarty->right_delimiter = '>}';
     $result = null;
     if (isset($_POST['u']) && isset($_POST['p'])) {
         //$password 是从数据库中读取的用户密码,现在暂定hello
         $password = "******";
         //计算密码和验证码的md5值
         if (md5($password . $_SESSION['VALIDATE_CODE']) == $_POST['p']) {
             $result = "The result is: right";
         } else {
             $result = "The result is: false";
         }
     }
     $smarty->assign("result", $result);
     $smarty->display($base . "\\md5demo.tpl");
 }
示例#28
0
 private function __construct()
 {
     $mode = isset($_GET['mode']) ? $_GET['mode'] : false;
     require 'core/models/class.Access.php';
     switch ($mode) {
         case 'login':
             $login = new Access();
             $login->Login();
             break;
         case 'reg':
             if (isset($_POST['faccion'])) {
                 $reg = new Access();
                 $reg->Register();
             } else {
                 $lng = new Lang();
                 $template = new Smarty();
                 $template->assign(array('x_user' => $lng->x_user, 'x_pass' => $lng->x_pass, 'x_email' => $lng->x_email, 'x_registrarme' => $lng->x_registrarme));
                 $template->display('public/registro.xnv');
             }
             break;
         default:
             $lng = new Lang();
             $template = new Smarty();
             $template->assign(array('x_user' => $lng->x_user, 'x_pass' => $lng->x_pass, 'x_recordar' => $lng->x_recordar, 'x_submit' => $lng->x_submit));
             $template->display('public/index.xnv');
             break;
     }
     unset($lng, $template);
 }
示例#29
0
 function request($class, $proc, $param = array(), $lRet = false)
 {
     $globals = $GLOBALS['globals'];
     $objData = Controller::Call($class, $proc, $globals, $param);
     if (isset($objData->view_file)) {
         $file = $objData->view_file . '.tpl';
     } else {
         $file = $class . '/' . $proc . '.tpl';
     }
     if (is_string($objData)) {
         if ($lRet) {
             return $objData;
         }
         echo $objData;
     } else {
         //if( file_exists( $globals->environment->dir_view . $file ) ){
         $smarty = new Smarty();
         $smarty->setTemplateDir($globals->environment->dir_view);
         $smarty->assign('class', $class);
         $smarty->assign('proc', $proc);
         $smarty->assign('param', $param);
         $smarty->assign('objData', $objData);
         $smarty->assign('tools', $globals->tools);
         $smarty->assign('environment', $globals->environment);
         if ($lRet) {
             return $smarty->fetch($file);
         }
         $smarty->display($file);
     }
 }
示例#30
0
 /**
  * display *$cache_id是变化的这样,smarty才可以动态缓存,缓存的ID 用URL来做!因为每一个URL是不相同的!$_SERVER['REQUEST_URI'];
  * 
  * @Param $resource_name 
  * @Param $cache_id 
  * @Param $compile_id 
  * @Access public
  * @Return void
  */
 function display($resource_name = '', $cache_id = NULL, $compile_id = NULL)
 {
     $this->assign('root', rtrim($GLOBALS['root'], '/'));
     $this->assign('app', $GLOBALS['app']);
     $this->assign('url', $GLOBALS['url']);
     $this->assign('res', $GLOBALS['res']);
     $this->assign('public', rtrim(MYPUBLIC, '/'));
     $this->assign('PUBLIC', $GLOBALS['public']);
     $this->assign('CSS', rtrim(__CSS__, '/'));
     $this->assign('IMAGES', rtrim(__IMAGES__, '/'));
     $this->assign('JS', rtrim(__JS__, '/'));
     $this->assign('UPLOAD', rtrim(__UPLOAD__, '/'));
     $this->assign('css', rtrim(CSS, '/'));
     $this->assign('js', rtrim(JS, '/'));
     $this->assign('images', rtrim(IMAGES, '/'));
     if (empty($resource_name)) {
         $resource_name = $_GET['m'] . '/' . $_GET['a'] . '.' . TPL_PREFIX;
         //这个就规定了必须新建一个控制器目录里面放模板文件
     } else {
         if (strstr($resource_name, '/')) {
             //如果有斜线的话就找指定的文件
             $resource_name = $resource_name . '.' . TPL_PREFIX;
             //这里的意思是传了  比如index/update
         } else {
             //这是只传方法名的情况,比如$this->display('display');
             $resource_name = $_GET['m'] . '/' . $resource_name . '.' . TPL_PREFIX;
         }
     }
     if (!file_exists($this->template_dir . $resource_name)) {
         Debug::addmsg('[<font color="red">模板错误</font>]:<font color="red">' . $this->template_dir . $resource_name . '模板不存在</font>');
     }
     parent::display($resource_name, $cache_id, $compile_id, TRUE);
 }