2012-06-23 18 views
0

我在magento中創建一個CMS頁面作爲即將推出的產品的預告片。我正在使用右欄的兩列,並使用後端的佈局更新XML來調用我爲右側製作的一些自定義塊。在Magento 1.6.2中調用右邊塊的靜態html

那麼現在我正在加載只是佔位符,然後在事後編輯phtmls。

如果我在右邊使用兩個塊,它看起來很好......但如果我添加更多,則整個頁腳會損壞並移動到右列。

我想在右側獲得3個自定義塊。

這是我的佈局更新XML

<reference name="right"> 
<block type="newsletter/subscribe" name="left.newsletter" template="newsletter/rightsubscribe.phtml"/> 
<block type="core/template" name="name1" template="page/custom/custom1.phtml"/> 
<block type="core/template" name="name2" template="page/custom/custom2.phtml"/> 
</reference> 

這裏是我使用的海關塊的HTML。

<div id="shop-with-confidence" class="white-box"> 
    <h3>Custom1</h3> 
    <div class="white-box-inner"> 
     Testing1 
    </div> 


    <div id="shop-with-confidence" class="white-box"> 
    <h3>Custom2</h3> 
    <div class="white-box-inner"> 
     Testing2 
    </div> 

有沒有人有任何想法,爲什麼這會破壞我正在編輯的網頁?

+0

由於我是一個新手,不能在這裏回答我自己的問題! – Dan

+0

這個人很糟糕。經過大約4個小時的故障排除和讀取許多magento XML文檔的方式,它只是錯過了每個文件上的關閉div。 我最初認爲我不能使用核心/模板變種的兩種相同的塊類型,並且顯然閱讀它的方式很多。 div監督FTL。 – Dan

+0

是的,這是我的建議,因爲它是唯一可能的選擇。 – benmarks

回答

0

OP已經爲自己解決了這個問題,但值得注意的是,可以輕鬆檢查父子塊關係以確定問題是否與框架或標記相關。

要檢查哪些父塊有子塊的列表,可以簡單地做一個模板如下:

Zend_Debug::dump($this->getChild()) //list of children 
Zend_Debug::dump($this->getSortedChildren()) //list of ordered children 

在缺少模板塊的情況下(core/text_list,例如「右」),人們也可以從子塊模板中做到這一點:

Zend_Debug::dump($this->getParentBlock()->getChild()) //list of children 
Zend_Debug::dump($this->getParentBlock()->getSortedChildren()) //list of ordered children 

參考Mage_Core_Block_Abstract瞭解更多信息。