当前位置: 首页>>代码示例>>PHP>>正文


PHP View::fetch方法代码示例

本文整理汇总了PHP中View::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP View::fetch方法的具体用法?PHP View::fetch怎么用?PHP View::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在View的用法示例。


在下文中一共展示了View::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDisplayFor

 public function testDisplayFor()
 {
     $View = new View();
     $View->Session = $this->getMock('SessionHelper', array('read'));
     $View->request = $this->getMock('CakeRequest', array('_readInput'));
     $View->request->addParams(array('models' => array('Article' => array()), 'controller' => 'articles', 'action' => 'view'));
     $Ratings = $this->getMock('RatingsHelper', array('getRandomId'), array($View));
     $Ratings->Session = $View->Session;
     $Ratings->setModels(array('Article' => 'Content.Article'));
     $Ratings->expects($this->once())->method('getRandomId')->will($this->returnValue(666));
     $data = array('Article' => array('id' => 1), 'RatingSummary' => array('total_rating' => 3.5, 'total_votes' => 42));
     $result_html = $Ratings->display_for($data);
     $result_script = $View->fetch('script_execute');
     $expected = array('tag' => 'div', 'attributes' => array('class' => 'rating'), 'child' => array('tag' => 'div', 'id' => 'rating-666', 'attributes' => array('class' => 'rateit bigstars')), 'children' => array('count' => 2));
     $this->assertTag($expected, $result_html);
     $expected = array('tag' => 'span', 'id' => 'message-666', 'attributes' => array('class' => 'rating-message'));
     $this->assertTag($expected, $result_html);
     $expected = array('tag' => 'span', 'id' => 'values-666', 'attributes' => array('class' => 'rating-values'), 'child' => array('tag' => 'span', 'content' => '3.50', 'attributes' => array('class' => 'rating')), 'children' => array('count' => 2, 'only' => array('tag' => 'span')));
     $this->assertTag($expected, $result_html);
     $expected = array('tag' => 'span', 'content' => '42', 'attributes' => array('class' => 'votes'));
     $this->assertTag($expected, $result_html);
     $this->assertRegExp('/\\$\\(\'#rating-666\'\\).rateit\\({/', $result_script);
     $this->assertRegExp('/readonly: false/', $result_script);
     $this->assertRegExp('/\\$\\(\'#rating-666\'\\).rateit\\(\'value\', 3.5\\);/', $result_script);
     $this->assertRegExp('#url: \'/feedback/ratings/add/Content.Article/1\'#', $result_script);
     $this->assertRegExp('/foreign_model: \'Article\',/', $result_script);
 }
开发者ID:cepedag14,项目名称:phkondo,代码行数:27,代码来源:RatingsHelperTest.php

示例2: testJsNonInline

 /**
  * JSの読み込みタグを出力する(インラインオフ)
  *
  * @return void
  */
 public function testJsNonInline()
 {
     // インラインオフ(boolean)
     $this->BcBaser->js('admin/function', false);
     $expected = '<script type="text/javascript" src="/js/admin/function.js"></script>';
     $result = $this->_View->fetch('script');
     $this->assertEquals($expected, $result);
 }
开发者ID:baserproject,项目名称:basercms,代码行数:13,代码来源:BcBaserHelperTest.php

示例3: fetch

 protected function fetch($tpl = '', $data = [])
 {
     $tpl = $tpl ?: $this->router['tpl'];
     if (method_exists($this, '__DisplayPre')) {
         $this->__DisplayPre();
     }
     //hook
     return $this->_view->fetch($tpl, $data);
 }
开发者ID:shampeak,项目名称:ap.so,代码行数:9,代码来源:Controller.php

示例4: fetch

 /**
  * Returns the HTML of a smarty template or false if was impossible to fetch.
  *
  * @param string $template
  * @return boolean
  */
 public function fetch($template)
 {
     try {
         $template = $this->getTemplate($template);
         $this->assignCommonVars();
         return $this->view->fetch($template);
     } catch (Exception_Configuration $e) {
         return false;
     }
 }
开发者ID:ninodafonte,项目名称:SIFO,代码行数:16,代码来源:Controller.php

示例5: fieldsDisplay

 public function fieldsDisplay($rid = 0)
 {
     //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
     $contents = [];
     if ($rid) {
         //编辑时读取原数据
         $contents = Db::table('reply_basic')->where('rid', $rid)->get();
     }
     View::with('contents', json_encode($contents ?: []));
     return View::fetch($this->template . '/fieldsDisplay.html');
 }
开发者ID:houdunwang,项目名称:hdcms,代码行数:11,代码来源:module.php

示例6: render

 public function render($template, $_vars = array(), $fetch = false)
 {
     $view = new View($template);
     $this->addVars($_vars);
     foreach ($this->vars as $key => $var) {
         $view->assign($key, $var);
     }
     if ($fetch === true) {
         return $view->fetch($view->getTemplate());
     }
     $view->display($view->getTemplate());
     return true;
 }
开发者ID:vincenthib,项目名称:framework,代码行数:13,代码来源:Response.class.php

示例7: testJs

 /**
  * JSの読み込みタグを出力する
  */
 public function testJs()
 {
     // ノーマル
     ob_start();
     $this->BcBaser->js('admin/startup');
     $result = ob_get_clean();
     $expected = '<script type="text/javascript" src="/js/admin/startup.js"></script>';
     $this->assertEqual($result, $expected);
     // 拡張子あり
     ob_start();
     $this->BcBaser->js('admin/startup.js');
     $result = ob_get_clean();
     $expected = '<script type="text/javascript" src="/js/admin/startup.js"></script>';
     $this->assertEqual($result, $expected);
     // インラインオフ(boolean)
     $this->BcBaser->js('admin/function', false);
     $expected = '<script type="text/javascript" src="/js/admin/function.js"></script>';
     $result = $this->_View->fetch('script');
     $this->assertEqual($result, $expected);
 }
开发者ID:kenz,项目名称:basercms,代码行数:23,代码来源:BcBaserHelperTest.php

示例8: _extend

 public function _extend($attr, $content, &$view)
 {
     if (strchr($attr['file'], '.blade')) {
         $obj = new View();
         return $obj->fetch($attr['file']);
     }
 }
开发者ID:Colorado-rom,项目名称:hdphp,代码行数:7,代码来源:HdphpTag.php

示例9: elseif

                $message = $MessageController->gameResult($cards);
                $sMainContentView = $CardsView->getCards($cards, $message);
            } elseif (isset($_POST['stand'])) {
                $previousRound = $_SESSION['cards'];
                $previousRound['user_id'] = $_POST['userId'];
                $cards = $CardsController->stand($previousRound);
                $message = $MessageController->gameResult($cards);
                $sMainContentView = $CardsView->getCards($cards, $message);
            }
        }
        break;
    case 'buyChips':
        break;
    case 'home':
        $homeView = new View();
        $sMainContentView = $homeView->fetch('home.tpl');
    default:
        break;
}
/*
 * Menu
 */
$MenuCtrl = new MenuController();
$active = $route[0];
$sMenuView = $MenuCtrl->getMenu($active);
/*
 * NavMap
 */
$sNavMapView = $MenuCtrl->getNavMap($active);
/*
 * Display the page
开发者ID:TimeaKadosa,项目名称:BlackJack,代码行数:31,代码来源:index.php

示例10: raw

 /**
  * set raw script or styles
  * @param null $content
  */
 public static function raw($content = null)
 {
     if (!is_null($content)) {
         /**
          * get fullpath
          */
         $fullPath = Config::basePath('http/web/tpl/raw/');
         $fullPath .= str_replace('::', '/', $content);
         $fullPath .= '.tpl';
         /**
          * fetch template
          */
         self::$raw[] = \View::fetch($fullPath);
     }
 }
开发者ID:rivomanana,项目名称:rv-slim-base,代码行数:19,代码来源:Assets.php

示例11: display

 /**
  * 显示模板
  * @param null $tpl
  * @param null $params
  * @param null $layout
  */
 protected function display($tpl = null, $params = null, $layout = null)
 {
     is_array($tpl) && (list($tpl, $params, $layout) = array(null, $tpl, $params));
     strpos($tpl, '/') || ($tpl = CTRL_NAME . '/' . ($tpl ?: ACTION_NAME));
     $this->_theme && ($tpl = $this->_theme . '/' . $tpl);
     // 主题
     $params = $params ? array_merge($this->_p, $params) : $this->_p;
     // 如果存在布局参数,则将模板数据写到content参数中,然后通过布局输出
     if ($layout) {
         $params['content'] = View::fetch($tpl, $params, PATH_APP_VIEW);
         $tpl = $this->_theme ? $this->_theme . '/' . $layout : $layout;
         // 主题
     }
     View::render($tpl, $params);
 }
开发者ID:shizg,项目名称:index,代码行数:21,代码来源:index.php

示例12: testStatisticsChart

 /**
  * Test statistics chart
  * 
  * @param array $statistics
  * @param string $result
  * @param array $settings
  * @dataProvider statisticsChartProvider
  */
 public function testStatisticsChart(array $statistics, $result, array $settings)
 {
     $this->skipUnless(CakePlugin::loaded('GoogleChart'), 'Please install imsamurai/cakephp-google-chart for this test');
     $View = new View();
     $Helper = new TaskHelper($View, $settings);
     $this->assertStringMatchesFormat($result, $Helper->statistics($statistics) . $View->fetch('script'));
 }
开发者ID:imsamurai,项目名称:cakephp-task-plugin,代码行数:15,代码来源:TaskHelperTest.php

示例13: get

 public static function get($template, $variables = null)
 {
     $view = new View($template);
     if ($variables) {
         foreach ($variables as $key => $value) {
             $view->{$key} = $value;
         }
     }
     return $view->fetch();
 }
开发者ID:peter-watters,项目名称:yo_WordPressTheme,代码行数:10,代码来源:view.php

示例14: showCorrectView

 public function showCorrectView(View $view)
 {
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === "xmlhttprequest") {
         echo $view->fetch();
         exit;
     } else {
         return $view->fetch();
     }
 }
开发者ID:netluxe,项目名称:cPanel-Extended,代码行数:9,代码来源:cpanelextended.php

示例15: contain

 /**
  * 包含一个子模板
  * @param $tpl
  * @param array $vars
  * @return string
  */
 function contain($tpl, $vars = array())
 {
     if ($tpl[0] == '/' && defined('VIEW_ROOT')) {
         $tpl = VIEW_ROOT . $tpl;
     } else {
         $tpl = __DIR__ . $tpl;
     }
     $view = new View();
     $view->set($vars);
     $view->set('block', $this->blocks);
     return $view->fetch($tpl);
 }
开发者ID:comdeng,项目名称:firegit,代码行数:18,代码来源:View.php


注:本文中的View::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。