"
<span class=""Apple-style-span"" style=""border-collapse: separate; color: #000000; font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;""><span class=""Apple-style-span"" style=""font-family: Verdana; font-size: 13px;"">
作者:Alan Storm
翻译:zhlmmc
<config>
<modules>
<Alanstormdotcom_Configviewer>
<version>0.1.0</version>
</Alanstormdotcom_Configviewer>
</modules>
</config> 第二个文件需要在如下位置创建
<config>
<modules>
<Alanstormdotcom_Configviewer>
<active>true</active>
<codePool>local</codePool>
</Alanstormdotcom_Configviewer>
</modules>
</config> 我们先不管这些文件是干什么的,以后会解释。建立好这两个文件以后,你的模块的骨架就已经完成了。Magento已经知道你的模块存在,但是现在你的模块不会做任何事情。我们来确认一下Magento确实装载了你的模块
<config>
<modules>...</modules>
<global>
<events>
<controller_front_init_routers>
<observers>
<alanstormdotcom_configviewer_model_observer>
<type>singleton</type>
<class>Alanstormdotcom_Configviewer_Model_Observer</class>
<method>checkForConfigRequest</method>
</alanstormdotcom_configviewer_model_observer>
</observers>
</controller_front_init_routers>
</events>
</global>
</config> 然后创建如下文件
<?php
class Alanstormdotcom_Configviewer_Model_Observer {
const FLAG_SHOW_CONFIG = 'showConfig';
const FLAG_SHOW_CONFIG_FORMAT = 'showConfigFormat';
private $request;
public function checkForConfigRequest($observer) {
$this->request = $observer->getEvent()->getData('front')->getRequest();
if($this->request->{self::FLAG_SHOW_CONFIG} === 'true'){
$this->setHeader();
$this->outputConfig();
}
}
private function setHeader() {
$format = isset($this->request->{self::FLAG_SHOW_CONFIG_FORMAT}) ?
$this->request->{self::FLAG_SHOW_CONFIG_FORMAT} : 'xml';
switch($format){
case 'text':
header("Content-Type: text/plain");
break;
default:
header("Content-Type: text/xml");
}
}
private function outputConfig() {
die(Mage::app()->getConfig()->getNode()->asXML());
}
}
?> 好了,代码编辑结束。清空你的Magento缓存,输入如下URL
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
"
丫丫个呸的,这是虫虫的重量级文章啊,必须顶!
######<div class=""ref mceNonEditable"">丫丫个呸的,这是虫虫的重量级文章啊,必须顶!
是重量级翻译 =.=
######magento是一个php框架?还是一个已成型的可作二次开发的系统哦?
######magento是一个php框架?还是一个已成型的可作二次开发的系统哦?
已成型的,可做二次开发的系统。
######
也曾经很多朋友想做在国外做店铺我给我的朋友介绍一款相当不错店铺,不过现在越做越大功能太多了。
######
这篇文章似乎早就翻译好了,是转载的吧!
######靠,太她娘的好了!我顶我顶我顶顶
######
应该是在<salesrule/>里面查找<calss/>标签 吧 不知道对不对 |