2011-06-13 44 views
0

在我的網站,我不想h1標籤出現,如果PAGE_ID == 14Magento的 - 網頁代碼問題

所以我下面的代碼,我添加了一個if語句來此(見下文) 。 當我刷新我的頁面時,我收到一條錯誤消息,說無法找到page_id。 於是,我就在我的if語句如下:

if (page_id==14) .... 
if (title == 'Welcome to EcoConvenience').... 
if (identifier == 'Slideshow-Test').... 

,並得到了一個錯誤對這些每一個。

那麼如何讓代碼識別cms_pages表中的這些變量中的任何一個?

<!-- start center --> 
<div id="main" class="col-main"> 
    <!-- start global messages --> 
    <?php echo $this->getChildHtml('global_messages') ?> 
    <!-- end global messages --> 
    <?php echo $this->getChildHtml('breadcrumbs') ?> 
    <div class="page-head"> 
    <h1><?php 
     if ($page_id = 14) 
     { echo Mage::getSingleton('cms/page')->getTitle(); } ?></h1> 
</div> 
<!-- start content --> 
<?php echo $this->getChildHtml('content') ?>&nbsp; 
<!-- end content --> 
</div> 
<!-- end center --> 

回答

0

試試這個!

$pageid = Mage::getBlockSingleton('cms/page')->getPage()->getIdentifier();