开发者

Not parsing layout xml in Magento

开发者 https://www.devze.com 2022-12-16 15:01 出处:网络
I am following the book \"Php Architects Guide to Programming Magento\" where i try to incorporate rewards feature in magento.

I am following the book "Php Architects Guide to Programming Magento" where i try to incorporate rewards feature in magento.

My problem is that the rewardpoints.xml file is not being parsed. What triggers Magento to parse the xml files(updates) from the Layout folder? Why is it not parsing re开发者_如何学Pythonwardpoints.xml file? I know it is not parsing because i left an error in the xml file and it is not showing up

Here is the rewardpoints.xml with the error(closing tag

rewardpoints/dashboard_points.phtml

Any explanation will help. Thank You Margots


A few quick guesses. If this doesn't work, let me know and we can try other things.

First, make sure you tell Magento that the layout exists. In your module config, make sure the following XML exists. You may need to change from <frontend> to <adminhtml> if you are currently developing the backend. Make sure that the layout file is in the corresponding layout directory (adminhtml or frontend).

<config>
    <frontend>
        <layout>
            <updates>
            <rewardpoints>
                <file>rewardpoints.xml</file>
            </rewardpoints>
            </updates>
        </layout>
    </frontend>
</config>

Next, make sure that the problem isn't a cached file. Head to your admin panel and click System > Cache Management. Either refresh or disable the cache for "Layouts". When developing a module, it often helps to disable the cache entirely so that you can immediately see your changes.

Finally, significantly less likely, but make sure that Magento can read your file. You don't specify anything about your environment, so I can't give specific commands, but make sure that your webserver has permission to read the layout file.

Hope that helps.

Thanks, Joe


I'm trying to do a similar thing, but the layout only works if I put into one of the following directories:

app/design/frontend/base/defaut/layout/[MYMODULE].xml
app/design/frontend/[PACKAGE]/defaut/layout/[MYMODULE].xml

I don't want to put it into the former because I read that base/default should stay the same, always. I don't want to put it into the latter because it's my theme package folder, which is not the correct place for an unrelated module.

I'm running 1.4.1.1. Where should I put this file?

EDIT: Got an answer on #magento

<Groenleer> mattalexx: you should not modify wiles in app/design/frontend/base  i (personally) see no problems in adding XML files. Hence it is the only directory you can trust on is present on the user system.
<rooty> mattalexx: place it in base (or default if your still coding 1.3)
<mattalexx> rooty, 1.4.1.1
<rooty> it will bubble up
<mattalexx> I've heard I should completely not touch that folder, as if it were part of the core.
<rooty> well thats true if your writing a customer module
<rooty> but if its a community module your planning on releasing to everyone
<rooty> thats the place to put it in
<mattalexx> rooty, I like to write customer modules as if I am to be releasing it to the world later. Usually it means that they're more portable
<mattalexx> Hm, okay, that's great. Thanks rooty 
<Groenleer> then go with the base/default
<Groenleer> but don't change any existing files to make yours work.

TL;DR: Use app/design/frontend/base/defaut/layout/[MYMODULE].xml

0

精彩评论

暂无评论...
验证码 换一张
取 消