<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                本節內容描述默認的模板在magento中是怎樣工作的。 ***** 模板是怎么指定的? 模板是由layout文件指定的,每個layout文件關聯到一個對應的模板。 在layout文件中,模板文件由 template屬性指定: 如下文件示例: `vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml` ``` <block class="Magento\Catalog\Block\Category\View" name="category.image" template="Magento_Catalog::category/image.phtml"> ``` 該layout的內容可以理解為,名字為"category.image"的block,他的內容由 Magento\_Catalog這個模塊的子目錄categoy下面的image.html模板來渲染。 Magento\_Catalog對應的目錄為: `vendor\magento\module-catalog\view\frontend\templates` ***** 模板路徑也可以通過Blcok類使用$\_template屬性指定: 如: vendor\\magento\\module-review\\Block\\View.php `protected $_template = 'Magento_Review::view.phtml';` ***** 模板位置: 1. Module模塊下的模板: 通常路徑為:`<module_dir>/view/frontend/templates/<path_to_templates>` 2.Theme主題下的模板: 通常路徑為:`<theme_dir>/<Namespace>_<Module>/templates/<path_to_templates>` ***** 模板從layout文件中獲取參數: 假設我們在layout文件中定義了如下參數: ``` <argument name="store_name" xsi:type="string">ExampleCorp</argument> ``` 在模板中我們有兩種獲取該參數的寫法: 1. `$block->getData('store_name')` 2. `$block->getStoreName()` 同樣,在模板中有兩種寫法用來判斷是否設置了該參數: 3. `$block->hasData('store_name')` 4. `$block->hasStoreName()`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看