【发布时间】:2016-06-09 07:44:06
【问题描述】:
我在 phalcon 中的模板有一些问题。它不会像以前那样渲染。这是一个 do 操作方法的示例。名为 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.
{{ } }}
{{ 而不是
【问题讨论】:
-
请阅读documentation,了解如何使用 Volt 模板语言。您的模板只不过是沿着模板编写 php,这就是我不会调试的。您的帖子也已损坏。