Jie*_*eng 2 zend-framework zend-view zend-layout
我知道并使用了非常基本的Zend Framework的Layouts,我在整个站点中使用了1个布局.但现在我需要一个更中间/有组织的设置.
div#mainContent占用整个12列(使用960gs)div#mainContent占用9列+侧栏,3列我正在考虑使用1个基本布局,其中2个子布局将"扩展".基本布局将只包含<html>声明headScripts等,直到子<body>布局将包含对包装的定义divs div.grid_12, grid_9, grid_3.我怎样才能实现这种"扩展",基本上,我只想重用代码
还有什么是渲染侧边框/小部件的好方法
小智 9
我在布局之间切换,具体取决于我网站的子域名.
这是我正在使用的布局插件......
class App_Layout_Controller_Plugin_Layout extends Zend_Layout_Controller_Plugin_Layout
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = $this->getLayout();
$filename = $layout->getLayoutPath() . '/' . $request->getModuleName() . '.' . $layout->getViewSuffix();
//check if the layout template exists, if not use the default layout set in application.ini
if (file_exists($filename))
{
$this->getLayout()->setLayout($request->getModuleName());
}
}
}
Run Code Online (Sandbox Code Playgroud)
当然,您可以根据自己的需要进行修改.
确保正确设置application.ini,包括以下元素......
resources.layout.layout = "default"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.pluginClass = "App_Layout_Controller_Plugin_Layout"
Run Code Online (Sandbox Code Playgroud)
就我而言,我有:
default.phtml,admin.phtml,clients.phtml
我希望这有帮助......
天使
| 归档时间: |
|
| 查看次数: |
6239 次 |
| 最近记录: |