我想请您帮助我了解查看部分如何“查看”zend框架中的布局部分。 在我的思维方式(我想像菜鸟)应该有一个根将视图(index.phtml)指向布局(designer.phtml)吧? 下面不是我的代码,我只是想弄清楚它。
这是代码的视图部分,文件的根目录是/ applications / xampp / xamppfiles / htdocs / mts / applications / modules / designer / views / scripts / index / index.phtml
<div style="width:100%; margin-bottom:20px; margin-top:5px;">
<span style="padding-left:10px; font-size:18px;">Designer <a href="javascript:void(0)" onClick="summonHelp('1')"><img alt="(?)" src="/style/images/help-8.png"/></a></span>
</div>
<?= $this->leftmenu; ?>
<div id="picFrame" style="text-align: center"></div>
<div id="middle_admin_content">
<fieldset>
<legend id="bookTitleLegend">Please select a book first</legend>
<div id="fileBox"><div id="innerBox"></div></div>
<div id="uploadSuccess" class="statusBox" style="display: none; background-color: #D9F5CB"><span>File Uploaded Successfully</span></div>
<div id="uploadFailed" class="statusBox" style="display: none; background-color: #EBB9B9"><span>File Upload Failed</span></div>
<div id="aboutTheBook" style="display: none">
<form id="aboutTheBookForm" action="" method="post">
<textarea name="about_the_book" id="about_the_book" cols="60" rows="10"></textarea>
<input type="submit" value="Save Text" name="saveCoverText"/>
<input type="hidden" value="" name="bookid" id="bookidField"/>
</form>
</div>
</fieldset>
</div>
这是代码的布局部分,文件的根目录是 /applications/xampp/xamppfiles/htdocs/mts/applications/layouts/scripts/designer.phtml
<?php echo $this->doctype() ?>
<html>
<head>
<title>InTech - Design</title>
<?php
echo $this->headTitle() . "\n";
echo $this->headMeta() . "\n";
?>
<?
echo $this->headStyle() . "\n";
echo $this->headLink() . "\n";
echo $this->headScript(). "\n";
?>
<?
/*
$jsContainer = $this->Minify_Container();
$jsContainer->appendFile('/js/jquery-1.4.2.min.js');
$jsContainer->appendFile('/js/jquery-ui-1.8.2.custom.min.js');
$jsContainer->appendFile('/js/jquery.autocomplete.js');
$jsContainer->appendFile('/js/jquery.bgiframe.min.js');
$jsContainer->appendFile('/js/jquery.idTabs.min.js');
$jsContainer->appendFile('/js/jquery/jquery.form.js');
$jsContainer->appendFile('/js/uploadify/jquery.uploadify.v2.1.4.min.js');
$jsContainer->appendFile('/js/designer/designer.js');
$jsContainer->appendFile('/js/scrollpane/jquery.jscrollpane.min.js');
$jsContainer->appendFile('/js/scrollpane/jquery.mousewheel.js');
echo $this->Minify($jsContainer, 'js');
$cssContainer = $this->Minify_Container();
$cssContainer->appendStylesheet('style/ui.all.css');
$cssContainer->appendStylesheet('js/jquery-ui-1.8.2.custom.css');
$cssContainer->appendStylesheet('style/site_css/designer_style.css');
$cssContainer->appendStylesheet('js/scrollpane/jquery.jscrollpane.css');
echo $this->Minify($this->headLink(), 'css');
echo $this->Minify($cssContainer, 'css');
*
*/
?>
<!-- MINIFIED ABOVE ------------------------->
<link rel="shortcut icon" href="/style/site_images/favicon.ico" type="image/x-icon" />
<link type="text/css" href="/style/ui.all.css" rel="stylesheet" />
<link type="text/css" href="/js/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
<link type="text/css" href="/style/site_css/designer_style.css" rel="stylesheet" />
<link type="text/css" href="/js/scrollpane/jquery.jscrollpane.css" rel="stylesheet" />
<!--<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>-->
<script type="text/javascript" src="/assets/modules/manager/basic/js/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="/assets/modules/manager/basic/js/plugins/jquery.form.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="/js/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
<!--<script type="text/javascript" src="/js/jquery/jquery.form.js"></script>-->
<script type="text/javascript" src="/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="/js/designer/designer.js"></script>
<script type="text/javascript" src="/js/scrollpane/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="/js/scrollpane/jquery.mousewheel.js"></script>
<!-- -->
</head>
<body>
<div id="dialog" style="display:none; font-size:12px; background-color:#ffffff;">
<div id="dialog_left" style="float:left; width:150px">
</div>
<div id="dialog_right">
</div>
</div>
<div id="dialogDelete" style="display: none">Delete Item?</div>
<!-- HEADER SITE AREA :: START -->
<div id="header">
<?php
$front = Zend_Controller_Front::getInstance();
$module = $front->getRequest()->getModuleName();
echo $this->render('header-designer.phtml', array(
'authenticated' => $this->authenticated
));
?>
</div>
<!-- HEADER SITE AREA :: END -->
<!-- CONTENT :: START -->
<div id="contentAdmin">
<div id="helpDialog" style="display: none"></div>
<?php echo $this->layout()->content ?>
</div>
<!-- CONTENT :: END -->
<!-- FOOTER SITE AREA :: START -->
<div id="footer">
<?php echo $this->render('footer.phtml', array(
'authenticated' => $this->authenticated
)) ?>
</div>
<!-- FOOTER SITE AREA :: START -->
</body>
</html>
答案 0 :(得分:1)
所有这些实施的具体机制涉及bootstrapping application resources并注册后期front-controller plugins。
但简短的回答是“系统”知道如何查找/呈现与请求的操作相关联的视图脚本,以及如何使用注入的视图脚本内容查找/呈现布局脚本。
请记住,在某些时候,您可能会在Layout
中引导configs/application.ini
资源。
您还引导了一个View
资源 - 无论是显式还是隐式 - 它知道如何呈现您的headTitle()
,headMeta()
,headScript()
等等(所有资源都使用视图呈现 - 帮助者),以及布局。
所以,“系统”意识到所有这些东西真的没有神秘感。