【发布时间】:2013-08-02 09:27:09
【问题描述】:
我创建了一个自定义模块,我想将自定义 css 样式添加到其中。我做了一些研究,发现正确的方法是将css添加到正确的文件夹中,然后使用layout.xml添加它。
我的问题是当我添加 css 时返回一条错误消息:
Invalid method Namespace_Module_Block_Blockname::addCss(Array([0] => css/mystyle.css))
目前 mystyle.css 在
skin/frontend/base/default/css/mystyle.css
我确实尝试将其添加到
Namespace/Module/css/mystyle.css but without success
我的布局文件设置如下
<handle>
<block type="modulename/block" name="reference_name" output="toHtml" template="Namespace/Module/filename.phtml" >
<action method="addCss"><stylesheeet>css/mystyle.css</stylesheeet></action>
<block type="modulename/block" name="reference_name" output="toHtml" template="Namespace/Module/filename.phtml" />
</block>
</handle>
在阅读了designing_for_magento之后,我还尝试将它包装在一个默认句柄中,这会产生一个空白屏幕。
在添加此命令之前没有收到错误,我做错了什么?
===编辑===
我现在已经尝试过(在节点中我也尝试过放置)
<user_preferences>
<reference name="head">
<action method="addCss"><link>css/normalize.css</link></action>
<block type="prefcentre/returnuser" name="prefcentre_returnuser" output="toHtml" template="ps/prefcentre/returnuser.phtml" >
<block type="prefcentre/preferences" name="prefcentre_options" output="toHtml" template="ps/prefcentre/preferences.phtml" />
</block>
</reference>
</user_preferences>
文件已经在前面提到的地方,并且
skin/frontend/default/module/css/mystyle.css
但这也没有用
【问题讨论】: