當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。