2012-10-02 54 views
2

我正在嘗試顯示登錄用戶的主頁和未登錄用戶的其他主頁。到目前爲止,我一直在使用標準主頁和url主鍵'home'作爲我的主頁。我用url鍵'home1'創建了一個新的cms頁面,它將用於未登錄的用戶。從模板文件中顯示一個cms頁面

我可以從未登錄的用戶頁面輸出一些內容,但如果我添加一個表格並使用wysisyg插入圖像,那麼當我查看頁面時,圖像src將被剝離。它只是顯示文本,如果我硬編碼圖像的罰款,但我需要能夠使用wysiwyg。

這兩個頁面都使用empty.phtml模板文件。

這裏面的模板文件,我有以下代碼

# Check if user is logged in and output the standard home page 
    if($this->helper('customer')->isLoggedIn()) { 
     echo $this->getChildHtml('content'); 
    } 
    else 
    { 
     # Load cms page for non logged in users then output the content 
     $model = Mage::getModel('cms/page')->load('home1','identifier'); 
     echo $model->getContent(); 
    } 

有可能這樣做,因此,如果有人知道它,然後我會很感激你輸入的更好的方法。

謝謝

回答

4

儘量展示,而不是使用兩個不育系的頁面無論是從靜態的Magento塊內容。

if($this->helper('customer')->isLoggedIn()) 
    { 
     // Static Block Content for Logged in Customers 
     echo $this->getLayout()->createBlock('cms/block')->setBlockId('logged_in_customers')->toHtml(); 
    } 
    else 
    { 
     // Static Block Content for Non-Logged in Customers 
     echo $this->getLayout()->createBlock('cms/block')->setBlockId('non_logged_in_customers')->toHtml(); 
    } 
+0

謝謝,這沒有把戲。我想最好是使用靜態塊來處理模板文件中的內容..這是顯示兩個不同主頁的最佳方式,正如我所做的那樣? – Rambo

相關問題