我为单个商店视图的两个主题创建了cms页面 我想在前端显示特定于主题的所有cms页面链接 即只有那些在特定主题中使用的cms页面链接才会出现 我用下面的函数来提取所有的cms页面..
public function getCMSPages(){
$storeId = $this->helper('core')->getStoreId();
$cms = Mage::getModel('cms/page')->getCollection()
->addFieldToFilter('is_active',1)
->addStoreFilter($storeId);
$url = Mage::getBaseUrl();
$html = "";
foreach($cms as $cmspage):
$page = $cmspage->getData();
if($page['identifier'] == "no-route" || $page['identifier'] == "enable-cookies" || $page['identifier'] == "empty"){
/* do nothing */
} else {
if($page['identifier'] == "home"){
$html .= "<li><a href=\"$url\" title=\"".$page['title']."\">".$page['title']."</a></li>\n";
} else {
$html .= "<li><a href=\"$url".$page['identifier']."\" title=\"".$page['title']."\">".$page['title']."</a></li>\n";
}
}
endforeach;
return $html;
}
我如何仅针对特定主题获取cms页面?
答案 0 :(得分:0)
您可以在此字段中添加主题过滤器$storeId = $this->helper('core')->getStoreId();
$cms = Mage::getModel('cms/page')->getCollection()
->addFieldToFilter('is_active',1)
->addFieldToFilter('custom_theme','default/default')
->addStoreFilter($storeId);
{{1}}