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


PHP Base_Controller::getView方法代码示例

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


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

示例1: action_winners

 public function action_winners()
 {
     $model = parent::getModel('Fight', 'Fight');
     $utils = new utils();
     $winners = $model->GetWinner($utils);
     $winnersViewData = $model->CalculateWinner($winners);
     if ($winnersViewData) {
         parent::setViewVars(array("winnersViewData" => $winnersViewData));
     }
     parent::setTemplate('SlapChallengeMain');
     parent::getView($this->controller, 'Winners');
     parent::render();
 }
开发者ID:GraphicLingoes,项目名称:codesamples,代码行数:13,代码来源:Fight_Controller.php

示例2: action_index

 public function action_index()
 {
     try {
         $target_dir = "./app_data/";
         $target_file = $target_dir . basename($_FILES["contestantsUpload"]["name"]);
         if (isset($_POST["submit"])) {
             // First check mime type to ensure correct file is being uploaded.
             $check = getimagesize($_FILES["contestantsUpload"]["tmp_name"]);
             $mimes = array('application/vnd.ms-excel', 'text/plain', 'text/csv', 'text/tsv');
             if (in_array($_FILES['contestantsUpload']['type'], $mimes)) {
                 // Next check size of file to ensure it does not violate limit.
                 if ($_FILES["contestantsUpload"]["size"] > 500000) {
                     // NOTE: in a production environment we would not give an error message
                     // with this much detail based on OWASP recommendations.
                     throw new Exception('Error, file exceeds maximum file size.');
                 }
                 // Next try to save the file to the app_data directory.
                 if (move_uploaded_file($_FILES["contestantsUpload"]["tmp_name"], $target_file)) {
                     // do nothing at this time.
                 } else {
                     throw new Exception('Error uploading file.');
                 }
             } else {
                 throw new Exception('Sorry, wrong file type.');
             }
         }
     } catch (Exception $e) {
         // Handle Error gracefully.
         parent::setViewVars(array("ErrorMessage" => $e->getMessage()));
         parent::setTemplate('SlapChallengeMain');
         parent::getView("Upload", "Index");
         parent::render();
         return;
     }
     // Instantiate model for Upload route.
     $model = parent::getModel('Upload', 'Upload');
     // Parse and store contents in databse.
     if ($model->ParseUpload($_FILES["contestantsUpload"]["name"], $this->utils)) {
         parent::setViewVars(array("UploadStatus" => "File has been uploaded successfully! <a class=\"btn btn-primary\" href=\"/Fight/Index\">Let's Fight</a>"));
     } else {
         parent::setViewVars(array("UploadStatus" => "There has been an issue please <a href=\"/\">Click Here to Try Again</a>."));
     }
     parent::setTemplate('SlapChallengeMain');
     parent::getView("Upload", "Index");
     parent::render();
 }
开发者ID:GraphicLingoes,项目名称:codesamples,代码行数:46,代码来源:Upload_Controller.php

示例3: action_index

	/**
	 * Run our request
	 *
	 * @param  string $url
	 */
	public function action_index()
	{
		try {
			if (!parent::$router) {
				throw new Exception("Router not set");
			}
			// Get our view
			parent::setViewVars(array(
					"testVariable" => "set from dispatch",
					"innerArray" => array("testing" => "Inner Array", "anotherIndex" => "Testing")
				));
			parent::setTemplate('SlapChallengeMain');
			parent::getView($this->controller, 'Index');
			parent::render();

		} catch (Exception $e) {
			

		}
	}
开发者ID:GraphicLingoes,项目名称:codesamples,代码行数:25,代码来源:Default_Controller.php


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