1.php iniphp
安裝pearhtml
設置include_pathapache
2.apachebootstrap
AllowOverrideapp
LoadModule rerwite去掉註釋ide
-
<VirtualHost *:
80>
-
ServerName quickstart.local
-
DocumentRoot /path/to/quickstart/public
-
-
SetEnv APPLICATION_ENV
"development"
-
-
<Directory /path/to/quickstart/public>
-
DirectoryIndex index.php
-
AllowOverride
All
-
Order
allow,
deny
-
Allow
from
all
-
</Directory>
-
</VirtualHost>
host 127.0.0.1 quickstart.localui
3.this
zf create project newprojectspa
htaccesscode
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
layout模板文件
zf enable layout
配置文件中加入resources.view[] =
或
配置文件中加入
resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
application/layouts/scripts/layout.phtml
- <?php echo $this->doctype() ?>
- <html>
- <head>
- <?php echo $this->headTitle() ?>
- <?php echo $this->headLink() ?>
- <?php echo $this->headStyle() ?>
- <?php echo $this->headScript() ?>
- </head>
- <body>
- <?php echo $this->layout()->content ?>
- </body>
- </html>
- 經過在booststrap文件中加入
-
- class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
- {
- protected function _initView()
- {
-
- $view = Zend_View();
- $view->doctype('XHTML1_STRICT');
- $view->headTitle('My First Zend Framework Application');
-
-
- $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
- 'ViewRenderer'
- );
- $viewRenderer->setView($view);
-
-
- return $view;
- }
- }