我試圖理解這一行代碼。如何在Magento中使用Mage :: helper?
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
1.對於開始被聲明的變量($_attributes)
2. Mage::helper('core')
助手是一個加載對象的方法?什麼是core
?一份文件?在哪裏可以找到這個文件?
3. decorateArray
是從core class
?
你能告訴我請這個代碼如何工作,給我一個簡單的例子嗎?
我試圖讓我的網頁
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
<?php if($_product->isSaleable() && count($_attributes)){
echo "de vanzare";
}
?>
也許評估條件假消息,並沒有顯示這個簡短的例子。我沒有錯誤,但沒有工作。
我想看看,如果我理解它是如何工作Mage::helper
(這就是爲什麼我做了這個例子)
提前感謝!
Mage :: helper('core')是位於[/Core/Helper/Data.php](http://docs.magentocommerce.com/Mage_Core/Mage_Core_Helper_Data.html)中的輔助類Mage_Core_Helper_Data的一個對象。 。請在開始使用Magento之前閱讀文檔。 –
@Cristi核心是模塊名稱,decorateArray是以下類中的一種方法,請參閱app/code/core/Mage/Core/Helper/Data.php文件。 – Muk