當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Smarty::display方法代碼示例

本文整理匯總了PHP中Smarty::display方法的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty::display方法的具體用法?PHP Smarty::display怎麽用?PHP Smarty::display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Smarty的用法示例。


在下文中一共展示了Smarty::display方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 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');
 }
開發者ID:andy-sheng,項目名稱:ebook,代碼行數:34,代碼來源:UploadController.class.php

示例2: handle

 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');
 }
開發者ID:andy-sheng,項目名稱:ebook,代碼行數:30,代碼來源:RegController.class.php

示例3: display

 public function display($name, $tpl_vars = array())
 {
     //die(var_dump($name));
     if (!empty($tpl_vars)) {
         $this->assign($tpl_vars);
     }
     echo $this->_smarty->display($name);
 }
開發者ID:nameNotNull,項目名稱:Yaf_smarty3.1.27,代碼行數:8,代碼來源:Adapter.php

示例4: _run

 /**
  * 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);
 }
開發者ID:nidzix,項目名稱:Newscoop,代碼行數:13,代碼來源:SmartyView.php

示例5: render

 /**
  * {@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();
 }
開發者ID:Andals,項目名稱:vine-demo,代碼行數:14,代碼來源:Smarty.php

示例6: render

 /**
  * 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);
 }
開發者ID:revolveweb,項目名稱:ppi-framework,代碼行數:18,代碼來源:Smarty.php

示例7: render

 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);
     }
 }
開發者ID:paulodacosta,項目名稱:LearnFlash,代碼行數:11,代碼來源:BaseController.php

示例8: AjaxTaskTwo

 /**
  * 
  * @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');
     }
 }
開發者ID:AlexandrKozyr,項目名稱:plariummorphy,代碼行數:16,代碼來源:Controller.class.php

示例9: _run

 /**
  * 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');
     }
 }
開發者ID:iLoiLohas,項目名稱:pinchshopper,代碼行數:20,代碼來源:Smarty.php

示例10: render

 /**
  * 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;
     }
 }
開發者ID:K-4U,項目名稱:Pr-IP-P2-02,代碼行數:18,代碼來源:cmsPage.class.php

示例11: runDisplay

 /**
  * 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');
     }
 }
開發者ID:WhiteSoldierI,項目名稱:asoworx,代碼行數:21,代碼來源:Smarty.php

示例12: __render

 /**
  * 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');
     }
 }
開發者ID:kix,項目名稱:kphp,代碼行數:19,代碼來源:Controller.class.php

示例13: view

 public function view($resource_name, $cache_id = null)
 {
     if (strpos($resource_name, '.') === false) {
         $resource_name .= '.tpl';
     }
     return parent::display($resource_name, $cache_id);
 }
開發者ID:randix0,項目名稱:DEVils,代碼行數:7,代碼來源:mysmarty.php

示例14: loadView

 /**
  * 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;
     }
 }
開發者ID:bhavitk,項目名稱:micro-struct,代碼行數:39,代碼來源:Controller.php

示例15: display

 /**
  * 重寫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);
 }
開發者ID:BGCX261,項目名稱:zlskytakeorder-svn-to-git,代碼行數:14,代碼來源:View_Smarty.class.php


注:本文中的Smarty::display方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。