久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='udZ8q'><style id='udZ8q'><dir id='udZ8q'><q id='udZ8q'></q></dir></style></legend>
      <bdo id='udZ8q'></bdo><ul id='udZ8q'></ul>
      <i id='udZ8q'><tr id='udZ8q'><dt id='udZ8q'><q id='udZ8q'><span id='udZ8q'><b id='udZ8q'><form id='udZ8q'><ins id='udZ8q'></ins><ul id='udZ8q'></ul><sub id='udZ8q'></sub></form><legend id='udZ8q'></legend><bdo id='udZ8q'><pre id='udZ8q'><center id='udZ8q'></center></pre></bdo></b><th id='udZ8q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='udZ8q'><tfoot id='udZ8q'></tfoot><dl id='udZ8q'><fieldset id='udZ8q'></fieldset></dl></div>

    1. <tfoot id='udZ8q'></tfoot>
      1. <small id='udZ8q'></small><noframes id='udZ8q'>

      2. ZF2 - 將控制器名稱放入布局/視圖中

        ZF2 - Get controller name into layout/views(ZF2 - 將控制器名稱放入布局/視圖中)
        <i id='1gX2q'><tr id='1gX2q'><dt id='1gX2q'><q id='1gX2q'><span id='1gX2q'><b id='1gX2q'><form id='1gX2q'><ins id='1gX2q'></ins><ul id='1gX2q'></ul><sub id='1gX2q'></sub></form><legend id='1gX2q'></legend><bdo id='1gX2q'><pre id='1gX2q'><center id='1gX2q'></center></pre></bdo></b><th id='1gX2q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1gX2q'><tfoot id='1gX2q'></tfoot><dl id='1gX2q'><fieldset id='1gX2q'></fieldset></dl></div>

        <legend id='1gX2q'><style id='1gX2q'><dir id='1gX2q'><q id='1gX2q'></q></dir></style></legend>

          <tbody id='1gX2q'></tbody>

        <small id='1gX2q'></small><noframes id='1gX2q'>

          <tfoot id='1gX2q'></tfoot>
              • <bdo id='1gX2q'></bdo><ul id='1gX2q'></ul>
                • 本文介紹了ZF2 - 將控制器名稱放入布局/視圖中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我知道使用 ZF1,您將使用自定義視圖助手檢索模塊/控制器名稱,該助手將獲取單例 frontController 對象并在那里獲取名稱.

                  I know with ZF1 you would retrieve the module/controller name using custom View Helpers that would get the singleton frontController object and get the name there.

                  使用 ZF2,因為它們消除了框架的很多單例性質并引入了 DI,我在其中為該模塊中的所有控制器指定了別名......我可以想象我會通過訪問 DI 或也許將當前名稱注入到布局中.

                  Using ZF2 as they've abolished alot of the singleton nature of the framework and introduced DI where I've specified aliases for all of my controllers within this module... I can imagine I would get it through accessing the DI or perhaps injecting the current name into the layout.

                  任何人都知道你會怎么做.我想有一百種不同的方法,但是在嗅探了幾個小時的代碼之后,我真的無法弄清楚它現在是如何完成的.

                  Anyone got any idea how you would do it. I guess there a hundred different ways but after sniffing about the code for a few hours I can't really figure out how its meant to be done now.

                  我想要控制器名稱的原因是將其作為特定控制器樣式的類添加到主體中.

                  The reason I wanted the controller name is to add it to the body as a class for specific controller styling.

                  謝謝,多姆

                  推薦答案

                  ZF2 出來了,骨架也出來了.這是在骨架頂部添加的,所以它應該是你最好的例子:

                  ZF2 is out and so is the skeleton. This is adding on top of the skeleton so it should be your best example:

                  內部模塊.php

                  public function onBootstrap($e)
                  {
                      $e->getApplication()->getServiceManager()->get('translator');
                      $e->getApplication()->getServiceManager()->get('viewhelpermanager')->setFactory('controllerName', function($sm) use ($e) {
                          $viewHelper = new ViewHelperControllerName($e->getRouteMatch());
                          return $viewHelper;
                      });
                  
                      $eventManager        = $e->getApplication()->getEventManager();
                      $moduleRouteListener = new ModuleRouteListener();
                      $moduleRouteListener->attach($eventManager);
                  }
                  

                  實際的 ViewHelper:

                  The actual ViewHelper:

                  // Application/View/Helper/ControllerName.php
                  
                  namespace ApplicationViewHelper;
                  
                  use ZendViewHelperAbstractHelper;
                  
                  class ControllerName extends AbstractHelper
                  {
                  
                  protected $routeMatch;
                  
                      public function __construct($routeMatch)
                      {
                          $this->routeMatch = $routeMatch;
                      }
                  
                      public function __invoke()
                      {
                          if ($this->routeMatch) {
                              $controller = $this->routeMatch->getParam('controller', 'index');
                              return $controller;
                          }
                      }
                  }
                  

                  在您的任何視圖/布局中

                  Inside any of your views/layouts

                  echo $this->controllerName()
                  

                  這篇關于ZF2 - 將控制器名稱放入布局/視圖中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                      <bdo id='qrpbw'></bdo><ul id='qrpbw'></ul>
                      • <legend id='qrpbw'><style id='qrpbw'><dir id='qrpbw'><q id='qrpbw'></q></dir></style></legend>

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

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

                            主站蜘蛛池模板: 精品国产视频 | 日本在线观看网址 | 亚洲成人精品在线观看 | 国产一区二区三区在线免费观看 | 中文字幕 国产 | 国产日韩欧美另类 | 国产免费福利 | 亚洲天堂中文字幕 | 欧美综合一区二区三区 | 午夜电影福利 | 国产高清视频 | 亚洲伦理自拍 | 中文字幕国产精品 | 网站黄色在线 | 一区二区在线免费观看 | 国产精品久久久久久久岛一牛影视 | 国产露脸国语对白在线 | 国产真实精品久久二三区 | 亚洲精品区 | 欧美一级淫片免费视频黄 | 久久综合久色欧美综合狠狠 | 国产精品欧美一区二区 | 成人在线电影在线观看 | 亚洲久久在线 | 久久这里只有精品首页 | 成年人精品视频 | 欧美精品一区二区三区一线天视频 | 91精品国产欧美一区二区 | 国产视频第一页 | 欧美中文一区 | 99视频在线 | 日韩福利 | 热99在线 | 少妇特黄a一区二区三区88av | 在线观看www高清视频 | 一区二区三区影院 | 日本精品久久 | 国产伊人精品 | 欧美精品一二三区 | 国产中文 | 久久精品久久精品久久精品 |