[英]phalcon set view template
我在Phalcon中的模板有一些問題。 它沒有渲染。 這是執行操作方法的示例。 動作稱為UploadSave。 在執行此操作之后,我要渲染圖像/上傳模板。
try {
$hash = $this->request->getPost('hash');
$File = $this->_getUploadedFile();
$Validator = new ImageQualityValidator();
if($Validator->isValid($File)){
$Image = $this->_saveImage($File);
$EnvCfg = self::_getEnvCfgDir();
$cfg_data = $EnvCfg->getObject(self::MYPAINT);
$this->response->redirect($cfg_data->host.'image/crop?hash='.$hash);
}else {
$this->getViewData()->hash = $hash;
$this->getViewData()->validation_error = 'Image is invalid!!';
}
} catch (AMyPaintExceptions $Exc) {
$this->getViewData()->validation_error = $Exc->getMessage();
}
$this->view->setMainView('image/upload');
return $this->getViewData();
但是結果是白屏。 image / upload.phtml不為空:
{{
if( false == $this->is_already_image_uploaded) {
echo $Tag->form(
[
"image/uploadSave",
"method" => "post",
"enctype" => "multipart/form-data"
]
);
}}
<p> {{ echo $Tag->fileField('my_photo'); }}</p>
<p> {{ echo $Tag->hiddenField(["hash", "value" => $this->hash]); }}</p>
<p> {{ echo $Tag->submitButton('Submit'); }} </p>
{{ if($this->validation_error){ }}
<p>{{ print_r($this->error_information);}}</p>
{{ } }}
{{ echo $Tag->endForm(); }}
{{
}
else { }}
Image has been uploaded already.
{{ } }}
{{ 代替
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.