我试图理解这行代码。
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
1.for started被声明为一个变量($_attributes)
2.Mage::helper('core')
helper 是加载对象的方法?什么是核心
?一份文件?在哪里可以找到这个文件?
3.decorateArray
是核心类
的方法吗?
你能告诉我这段代码是如何工作的并给我一个简单的例子吗?
我试图在我的页面中制作这个简短的例子
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
<?php if($_product->isSaleable() && count($_attributes)){
echo "de vanzare";
}
?>
也许条件被评估为错误消息并且未被显示。我没有收到任何错误,但无法正常工作。
我想看看我是否理解它是如何工作的Mage::helper
(这就是我做这个例子的原因)
提前致谢!
最佳答案
Mage::helper('core')
属于 app/code/core/Mage/Core/Helper。你可以在这个路径下找到 decorateArray() 到 data.php 中。
Mage 文件夹包含 magento 的核心类。
关于php - Magento 中的 Mage::helper 如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31513098/