簡體   English   中英

Magento在一次安裝中找到模塊XML,在另一次安裝中找不到

[英]Magento finds module XML in one install, and not another

我一直在為Magento開發插件,並且在我的layout / name.xml文件中有一個全局塊,其中沒有xml標記,如下所示:

<block name="one.two.three" template="project/button.phtml" />

這個想法是能夠在任何地方調用getBlockHtml(“ one.two.three”)並能夠看到beta.phtml。 我的工作沒有問題。

為了測試插件的安裝過程,我嘗試從頭開始安裝另一個magento。 我將插件安裝在與第一個插件相同的目錄中,並從較早的安裝版本中復制/粘貼了getBlockHtml,但沒有任何顯示(甚至沒有模板提示)! 添加默認引用無濟於事。

盡管adminhtml菜單和mysql安裝腳本都可以工作,但顯然沒有檢測到我的xml文件。 知道為什么會這樣嗎? 是的,我已經清除了無數次緩存。

編輯:

兩種安裝的版本均為1.7.0.2

這兩個安裝都在同一台計算機上,因此它們的文件系統和大小寫可能是相同的。 同一計算機上的兩個計算機是否區分大小寫,是否曾經有過這種情況?

安裝插件:我們有一個腳本,可以將文件復制到Magento安裝中,到目前為止,該腳本在第一個安裝中一直有效,而第二個插件正是我一直在做的事情。 為了確認,在復制文件時會添加magento數據庫中的條目和表。

我的布局存儲在常規布局文件夾中:app / design / layout / projectEmbeds.xml。 我意識到這不是一個常見的約定,但是在進入這個項目之前就像這樣,並且它一直在起作用,所以我沒有弄亂它。 我認為此決定是為了使它看起來像獨立的網站主題。

同樣,我的插件存儲在app / code / local /-> Project / Embeds中,其中應包含塊,控制器等,Helper,Model和sql。

有問題的button.phtml位於app / design / frontend / default / default / project中

我的config.xml文件存儲在上述目錄的etc中,如下所示。 任何引用Project_Banner的內容都很重要,而幾乎完全不推薦使用Project_Embed。

<config>    
<modules>
    <Project_Embeds>
        <version>0.1.0</version>
    </Project_Embeds>
</modules>
<frontend>
    <routers>
        <embeds>
            <use>standard</use>
            <args>
                <module>Project_Embeds</module>
                <frontName>embeds</frontName>
            </args>
        </embeds>
    </routers>  
    <layout>
        <updates>
            <embeds>
                <file>projectEmbeds.xml</file>
            </embeds>
        </updates>
    </layout>
</frontend>
<global>
    <resources>
    <project_embed_setup>
        <setup>
            <module>Project_Embeds</module>
            <class>Project_Embeds_Model_Mysql4_Setup</class>
        </setup>
    </project_embed_setup>
    </resources>
    <models>
        <embeds>
            <class>Project_Embeds_Model</class>
            <resourceModel>embeds_mysql4</resourceModel>
        </embeds>
        <projectbanner>
            <class>Project_Banner_Model</class>
            <resourceModel>banner_mysql4</resourceModel>
        </projectbanner>
        <embeds_mysql4>
            <class>Project_Embeds_Model_Mysql4</class>
            <entities>
                <embeds>
                    <table>project_embed</table>
                </embeds>
                <banner>
                    <table>project_banner</table>
                </banner>
            </entities>
        </embeds_mysql4>
    </models>
    <resources>
        <embeds_setup>
            <setup>
                <embeds>Project_Embeds</embeds>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </embeds_setup>
        <embeds_write>
            <connection>
                <use>core_write</use>
            </connection>
        </embeds_write>
        <embeds_read>
            <connection>
                <use>core_read</use>
            </connection>
        </embeds_read>
    </resources>
    <blocks>
        <embeds>
            <class>Project_Embeds_Block</class>
        </embeds>
    </blocks>
    <helpers>
        <embeds>
            <class>Project_Embeds_Helper</class>
        </embeds>
    </helpers>
</global>
<admin>
    <routers>
        <thisprojectname>
            <use>admin</use>
            <args>
                <module>Project_Embeds</module>
                <frontName>project</frontName>
            </args>
        </thisprojectname>
    </routers>
    <!-- default admin design package and theme -->
    <design>
        <package>
            <name>base</name>
        </package>
        <theme>
            <default>default</default>
        </theme>
    </design>
</admin>
<adminhtml>
    <menu>
        <embeds translate="title" module="embeds">
            <title>Project</title> 
            <sort_order>9999</sort_order>
            <children>
                <projectbanner module="embeds">
                    <title>Edit Coupon</title>
                    <sort_order>1</sort_order>
                    <action>embeds/adminhtml_banner</action>
                </projectbanner>
            </children>
        </embeds>
    </menu> 
    <layout>
        <updates handle="index_settings">
            <embeds>
                <file>projectEmbeds.xml</file>
            </embeds>
        </updates>
    </layout>
</config>

嘗試在使用的主題中添加projectEmbeds.xml文件,即默認我猜

所以添加

 /app/design/frontend/default/default/layout/

並調用里面的塊

<default></default>

讓我知道是否有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM