I have created cms pages for two themes of a single store view.
I want to show all the cms pages links in the front end which is specific to the theme.
ie only those cms page links should come which is used in a particular theme.
I have used below function to extract all the cms pages..
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;
}
How can I get cms pages only for a particular theme ?
you can add theme filter custom_theme
on this field
$storeId = $this->helper('core')->getStoreId();
$cms = Mage::getModel('cms/page')->getCollection()
->addFieldToFilter('is_active',1)
->addFieldToFilter('custom_theme','default/default')
->addStoreFilter($storeId);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.