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


PHP View::assign方法代码示例

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


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

示例1: actionOne

 public function actionOne()
 {
     $id = isset($_GET['id']) ? $_GET['id'] : 1;
     $view = new View();
     $page = new PageController();
     $view->assign('item', News::getOne($id));
     $view->assign('links', $page->createLink($this->ctrl));
     $view->display($this->view_one);
 }
开发者ID:alexx-gsm,项目名称:php_blog,代码行数:9,代码来源:AbstractController.php

示例2: messageAction

 /**
  * Messages Example
  * @return null
  */
 public function messageAction()
 {
     $View = new View('examples/message');
     $View->assign('_title_', _('Message Examples'));
     $View->assign('_message_', "Ejemplo de como abrir un mensaje desde el controlador");
     $View->display();
 }
开发者ID:richistron,项目名称:TianguisCabal,代码行数:11,代码来源:ExamplesController.php

示例3: multipageAction

 /**
  * multiple page thingy
  * @return null
  */
 public function multipageAction()
 {
     $Request = Request::getInstance();
     $template = $Request->template;
     $pages = array('intro' => 'Introducción', 'mvc' => 'Model View Controller', 'layer' => 'Good Cake, Bad Cake', 'diagram_simplified' => 'Diagrama', 'diagram' => 'Diagrama Extendido', 'credits' => 'Creditos');
     $links = '<p>';
     foreach ($pages as $page => $name) {
         $links .= "<a href=\"" . BASE_URL . "/index/multipage/?template={$page}\">{$name}</a>  ";
     }
     $links .= "</p>";
     $View = new View("index/{$template}");
     $View->assign('_title_', $pages[$template]);
     $View->assign('links', $links);
     $View->display();
 }
开发者ID:richistron,项目名称:TianguisCabal,代码行数:19,代码来源:IndexController.php

示例4: index

 function index()
 {
     $chart_pie = $chart_line = null;
     //love easy
     $this->load_library("Charts");
     $data = array(array('OSX', 10), array('Win', 3), array('Unix', 7));
     $this->Charts->set_data($data);
     //$chart_pie = $this->Charts->draw_pie();
     $this->Charts->load_csv(WEBSITE_DIR . "assign_execution_time.csv");
     $chart_line = $this->Charts->draw_line();
     $tpl = new View();
     $tpl->assign("chart_pie", $chart_pie);
     $tpl->assign("chart_line", $chart_line);
     $tpl->draw("charts/charts");
 }
开发者ID:jffuchs,项目名称:rainframework,代码行数:15,代码来源:charts.php

示例5: display

 public function display()
 {
     $view = new View();
     $view->setTemplate('header');
     $view->assign('title', 'openmuseum');
     return $view->loadTemplate();
 }
开发者ID:GeorgesAlkhouri,项目名称:openmuseum,代码行数:7,代码来源:HeaderController.php

示例6: hookModuleOutputBottom

 /**
  * hook: module_output_bottom
  * Show comments and comments form
  *
  * @param array $msc
  * @param int $contentType
  * @param string $sector
  * @param string $title
  * @return mixed
  */
 public function hookModuleOutputBottom(array $mcs, $contentType, $sector, $title)
 {
     if ($sector == 'SC' && $contentType & Zula_ControllerBase::_OT_CONTENT_DYNAMIC && !($contentType & Zula_ControllerBase::_OT_CONFIG)) {
         $requestPath = $this->_router->getRequestPath(Router::_TRIM_ALL);
         $view = new View('display/linear.html', 'comments');
         $view->assign(array('TITLE' => $title));
         $view->assignHtml(array('COMMENTS' => $this->_model('comments', 'comments')->get($requestPath)));
         if ($this->_acl->check('comments_post')) {
             /**
              * Store the hash path as a valid comment path, then build the
              * form view and output both views
              */
             $hashPath = zula_hash($requestPath);
             $_SESSION['mod']['comments'][$hashPath] = array('path' => $requestPath, 'siteType' => $this->_router->getSiteType());
             $form = new View('form.html', 'comments');
             $form->assign(array('comments' => array('hash' => $hashPath, 'name' => $this->_session->getUser('username'), 'website' => null, 'body' => null)));
             // Antispam/Captcha
             $antispam = new Antispam();
             $form->assignHtml(array('CSRF' => $this->_input->createToken(true), 'ANTISPAM' => $antispam->create()));
             return $view->getOutput() . $form->getOutput();
         } else {
             return $view->getOutput();
         }
     }
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:35,代码来源:listeners.php

示例7: indexAction

 /**
  * indexAction
  *
  * Index action of main controller forum module
  *
  * @return null
  */
 public function indexAction()
 {
     // assign data into view
     \View::assign(array('title' => \View::$language->forum_main_title, 'h1' => \View::$language->forum_main_title, 'forumsTree' => helpers\ForumsTreeHelper::getTree()));
     // set output layout
     \View::setLayout('forum-main.phtml');
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:14,代码来源:mainController.php

示例8: action_index

 /**
  * 首页
  *+----------------------------
  * http://yourdomain/index.php/
  */
 public function action_index()
 {
     //实例化一个视图对象
     $view = new View('index.php');
     $view->assign('title', 'hello world')->render();
     //绑定变量并渲染视图
 }
开发者ID:adawongframework,项目名称:project,代码行数:12,代码来源:Welcome.php

示例9: Index

	public static function Index(View $page) {
		$dir = $page->getParameter('directory');
		if (!$dir) {
			$page->error = View::ERROR_BADREQUEST;
			return;
		}

		////// Security checks...

		// Usage of '..' is explicitly denied, as it can escape the filesystem.
		if (strpos($dir, '../') !== false) {
			$page->error = View::ERROR_BADREQUEST;
			return;
		}

		// Directory must contain at least one directory in.
		// And it also must start with public/
		if (!preg_match('/^public\/[a-z0-9]+/', $dir)) {
			$page->error = View::ERROR_BADREQUEST;
			return;
		}

		// Now I can finally start the actual logic.
		$d = Core::Directory($dir);
		if (!$d->isReadable()) {
			$page->error = View::ERROR_NOTFOUND;
			return;
		}

		$page->assign('files', $d->ls());
	}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:31,代码来源:DirectoryController.class.php

示例10: assign

 /**
  * Assign a variable to the template.
  *
  * @param string|array $tpl_var
  * @param mixed $value
  * @return \Smarty_Internal_Data
  */
 public function assign($tpl_var, $value)
 {
     if ($tpl_var != 'modules') {
         $this->addToDebug($tpl_var, $value, 'assigns');
     }
     return $this->view->assign($tpl_var, $value);
 }
开发者ID:ninodafonte,项目名称:SIFO,代码行数:14,代码来源:Controller.php

示例11: display

 public function display()
 {
     $view = new View();
     $view->setTemplate('navBar');
     $view->assign('active', $this->active);
     return $view->loadTemplate();
 }
开发者ID:GeorgesAlkhouri,项目名称:openmuseum,代码行数:7,代码来源:NavigationController.php

示例12: main

 public function main()
 {
     //Create a new view and pass it our template
     $view = new View(strtolower($this->viewfile));
     //Assign Page Variable
     $view->assign('var1', 'About page variable.');
 }
开发者ID:jstoyles,项目名称:jms-mvc,代码行数:7,代码来源:about.php

示例13: testCss

 /**
  * CSSの読み込みタグを出力する
  */
 public function testCss()
 {
     // ノーマル
     ob_start();
     $this->BcBaser->css('admin/import');
     $result = ob_get_clean();
     $expected = '<link rel="stylesheet" type="text/css" href="/css/admin/import.css" />';
     $this->assertEqual($result, $expected);
     // 拡張子あり
     ob_start();
     $this->BcBaser->css('admin/import.css');
     $result = ob_get_clean();
     $expected = '<link rel="stylesheet" type="text/css" href="/css/admin/import.css" />';
     $this->assertEqual($result, $expected);
     // インラインオフ(array)
     $this->BcBaser->css('admin/import.css', array('inline' => false));
     $expected = '<link rel="stylesheet" type="text/css" href="/css/admin/import.css" />';
     $result = $this->_View->Blocks->get('css');
     $this->assertEqual($result, $expected);
     $this->_View->Blocks->end();
     // インラインオフ(boolean)
     $this->BcBaser->css('admin/import.css', false);
     $expected = '<link rel="stylesheet" type="text/css" href="/css/admin/import.css" />';
     $this->_View->assign('css', '');
     $this->assertEqual($result, $expected);
 }
开发者ID:kenz,项目名称:basercms,代码行数:29,代码来源:BcBaserHelperTest.php

示例14: actionOne

 public function actionOne()
 {
     $id = $_GET['id'];
     $item = News::getOne($id);
     $view = new View();
     $view->assign('item', $item);
     $view->display('news/one.php');
 }
开发者ID:asart,项目名称:phpversus2,代码行数:8,代码来源:NewsController.php

示例15: testCallMethodOnView

 public function testCallMethodOnView()
 {
     View::useLib('Mock');
     $view = new View();
     $view->assign('chuck', 'norris');
     $this->assertEqual(1, count(MockView::$var));
     $this->assertEqual('norris', MockView::$var['chuck']);
 }
开发者ID:AF83,项目名称:toupti,代码行数:8,代码来源:test_view.php


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