[tpl + mock data] + docker => page
Write and render smarty template with no environment depend.
There is a smaller version registry.aliyuncs.com/do/smarty
(60MB) avaiable
- Supports remote mock data
- Yii 1.1.13
- Smarty 3.1
- nginx 1.0.15
- Install docker
Recommend docker beta, no more Virtualbox and many awesome features.
- Start a container
$ docker run -p 8000:80 registry.aliyuncs.com/do/yii
Waiting a while, the first startup need to download a image, after the container is running we can open http://localhost:8000/ in browser.
Yes it works, we may see a simple page because there is a smarty render server in the container.
$ docker run -p 8000:80 -v ~/tmp/views:/views registry.aliyuncs.com/do/yii
A basic file structure be generated in ~/tmp/views
:
├── views
│ ├── mock
│ │ └── index.json
│ ├── static
│ │ └── css
│ │ └── index.css
│ └── tpl
│ └── index.tpl
Try to edit it and refresh the browser.
/ -> tpl/index.tpl
/detail -> tpl/detail.tpl
/sub/page -> tpl/sub/page.tpl
/static/reset.css -> static/reset.css
/static/css/index.css -> static/css/index.css
$ docker run -p 8000:80 -p 2222:22 registry.aliyuncs.com/do/yii
Add a port map (2222
:22
), then:
$ ssh root@localhost -p 2222
Notice that the default password is
123
Nope, after you understand the file structure, it's better to generate your view
files and mount the folder.
$ mkdir -p views/{mock,static/css,tpl} && touch views/{mock/index.json,static/css/index.css,tpl/index.tpl}