視圖模板用的smarty3模板 并自定義模板定界符為:<{和}> (為了防止和jquery模板沖突)
這里僅對簡單語法作介紹,更多語法請參考[smarty3中文手冊](https://www.smarty.net/docs/zh_CN/)
視圖目錄為:Applications/webApp/view/控制器名(首字母大寫其余字母小寫)。
所有視圖文件應統一放在視圖目錄下并以.html結尾。
控制器基類渲染函數為display($html,$data),其中$html為視圖文件地址(相對于視圖目錄)。$data為傳遞變量數組。
示例:調用Applications/webApp/view/User/hello.html作為視圖文件
```
namespace controller;
use workerWeb\web\Controller;
class User extends Controller{
public function index (){
return $this->display('hello');
}
}
```
如果不傳$html會以當前action的小寫格式作為視圖文件地址
如:
```
namespace controller;
use workerWeb\web\Controller;
class User extends Controller{
public function index (){
return $this->display();
}
}
```
會調用Applications/webApp/view/User/index.html作為視圖文件。
$data必須傳遞數組格式,其作用為將php變量傳遞到視圖文件中
如:
```
namespace controller;
use workerWeb\web\Controller;
class User extends Controller{
public function index (){
$name = 'word';
return $this->display('',['name'=>$name]);
}
}
```
視圖文件渲染變量方式為`<{$變量名}>`
如:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
hello <{$name}>!
</body>
</html>
```

還有一種變量傳遞方式為調用控制器基類方法assign($name,$value);
$name為傳遞參數名,$value為值。
調用示例:
```
//控制器文件
namespace controller;
use workerWeb\web\Controller;
class User extends Controller{
public function index (){
$name = 'word';
$this->assign('name',$name);
return $this->display();
}
}
```
更多語法請參考[smarty3中文手冊](https://www.smarty.net/docs/zh_CN/)