<legend id='IUUlM'><style id='IUUlM'><dir id='IUUlM'><q id='IUUlM'></q></dir></style></legend>

      1. <tfoot id='IUUlM'></tfoot>

        <small id='IUUlM'></small><noframes id='IUUlM'>

        <i id='IUUlM'><tr id='IUUlM'><dt id='IUUlM'><q id='IUUlM'><span id='IUUlM'><b id='IUUlM'><form id='IUUlM'><ins id='IUUlM'></ins><ul id='IUUlM'></ul><sub id='IUUlM'></sub></form><legend id='IUUlM'></legend><bdo id='IUUlM'><pre id='IUUlM'><center id='IUUlM'></center></pre></bdo></b><th id='IUUlM'></th></span></q></dt></tr></i><div id='IUUlM'><tfoot id='IUUlM'></tfoot><dl id='IUUlM'><fieldset id='IUUlM'></fieldset></dl></div>
          <bdo id='IUUlM'></bdo><ul id='IUUlM'></ul>
      2. Zend 框架 - 在呈现布局之前执行的最后一段代码

        时间:2023-10-02

        <small id='H3A3K'></small><noframes id='H3A3K'>

          1. <tfoot id='H3A3K'></tfoot>
          2. <legend id='H3A3K'><style id='H3A3K'><dir id='H3A3K'><q id='H3A3K'></q></dir></style></legend>

            <i id='H3A3K'><tr id='H3A3K'><dt id='H3A3K'><q id='H3A3K'><span id='H3A3K'><b id='H3A3K'><form id='H3A3K'><ins id='H3A3K'></ins><ul id='H3A3K'></ul><sub id='H3A3K'></sub></form><legend id='H3A3K'></legend><bdo id='H3A3K'><pre id='H3A3K'><center id='H3A3K'></center></pre></bdo></b><th id='H3A3K'></th></span></q></dt></tr></i><div id='H3A3K'><tfoot id='H3A3K'></tfoot><dl id='H3A3K'><fieldset id='H3A3K'></fieldset></dl></div>
                  <bdo id='H3A3K'></bdo><ul id='H3A3K'></ul>

                    <tbody id='H3A3K'></tbody>
                • 本文介绍了Zend 框架 - 在呈现布局之前执行的最后一段代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想在渲染布局之前执行一些代码,然后执行所有其他代码.我会把那个代码放在哪里?

                  我特别想在布局使用 headLink、headScript 和 inlineScript 视图助手中引用的文件之前对其进行修改.

                  以下是我要采取的步骤:

                  1. 循环那些视图助手中的文件
                  2. 列出本地文件
                  3. 从视图助手中删除本地文件
                  4. 将本地文件列表作为参数引用到服务器脚本,该脚本将它们组合起来用于单个 HTTP 请求
                  5. 将新的组合脚本引用添加到适当的视图助手

                  <小时>

                  前端控制器插件似乎不会帮助我实现这一点,原因如下:

                  1. postDispatch() 在执行每个控制器操作后执行,我需要样式表/javascripts 的完整列表
                  2. dispatchLoopShutdown() 在控制器动作循环后执行,但此时布局已经呈现

                  <小时>

                  正如 Rufinus 所建议的,我通过扩展视图助手解决了这个问题.(镜像)

                  您可以通过插件访问的最后一部分应该是 dispatchLoopShutdown

                  ZendFramework2 参见 http://zendframework2.de/en/cheat-sheet.html或 这个 gdoc

                  I want to execute some code right before the layout is rendered, after all other code is executed. Where would I put that code?

                  I am specifically trying to modify the files referenced in the headLink, headScript, and inlineScript view helpers before they're used by the layout.

                  Here are the steps I want to take:

                  1. Loop over the files in those view helpers
                  2. Make a list of the local files
                  3. Remove local files from the view helpers
                  4. Reference the local file list as a parameter to a server script that combines them for a single HTTP request
                  5. Add that new combine script reference to the appropriate view helper


                  It doesn't appear that a Front Controller Plugin is going to help me accomplish this, and here's why:

                  1. postDispatch() gets executed after every controller action that's executed, and I need the full list of stylesheets/javascripts
                  2. dispatchLoopShutdown() gets executed after the controller action loop, but the layout has already been rendered at this point


                  As Rufinus suggested, I solved this by extending the View Helpers. My question from that angle as well as the solution is here.

                  解决方案

                  see Orginal PDF created by Thorsten Ruf (Mirror)

                  the very last part you can access via plugin should be dispatchLoopShutdown

                  EDIT: For ZendFramework2 see http://zendframework2.de/en/cheat-sheet.html or this gdoc

                  这篇关于Zend 框架 - 在呈现布局之前执行的最后一段代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 Javascript/PHP/mySQL 的日历 下一篇:Zend_Cache:加载缓存数据后,字符编码好像乱了

                  相关文章

                  最新文章

                  <tfoot id='s68No'></tfoot>
                  • <bdo id='s68No'></bdo><ul id='s68No'></ul>

                    <legend id='s68No'><style id='s68No'><dir id='s68No'><q id='s68No'></q></dir></style></legend>
                  1. <i id='s68No'><tr id='s68No'><dt id='s68No'><q id='s68No'><span id='s68No'><b id='s68No'><form id='s68No'><ins id='s68No'></ins><ul id='s68No'></ul><sub id='s68No'></sub></form><legend id='s68No'></legend><bdo id='s68No'><pre id='s68No'><center id='s68No'></center></pre></bdo></b><th id='s68No'></th></span></q></dt></tr></i><div id='s68No'><tfoot id='s68No'></tfoot><dl id='s68No'><fieldset id='s68No'></fieldset></dl></div>

                      <small id='s68No'></small><noframes id='s68No'>