当前位置: 首页>>代码示例>>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;未经允许,请勿转载。