诗意的边缘
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

3.3 开启layout布局模板

Zend Framework默认没有开启layout,要使用layout,需要在终端中通过以下命令将其开启:

zf enable layout

执行以上命令,会提示如下:

        Layouts have been enabled, and a default layout created at /var/www/kehuanedu/application/layouts/scripts/layout.phtml
        A layout entry has been added to the application config file.

打开application文件夹,会看到里面多了一个layout/script目录,里面有一个layout.phtml,这是刚才开启layout时,系统自行创建的默认的布局文件。

另外,打开application/configs/application.ini配置文件,也可以看到多了以下一行配置:

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

这一行配置定义了layout模板布局文件所在的路径,也是刚才开启layout的时候,由ZF tool自动添加进来的。