Magento Forum

Small question
 
austerus
Jr. Member
 
Total Posts:  5
Joined:  2008-04-21
 

Greetings everyone,

I need to do this in a small template ... I need to have a custom menu that is build from: links to all pages defined in the CMS section and links to all categories. Now ... for the categories I see there is the $this->getStoreCategories() function ... but how about all pages defined in the CMS?

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

Maybe like this:

$collection Mage::getModel('cms/page')->getCollection();
 
Magento Community Magento Community
Magento Community
Magento Community
 
austerus
Jr. Member
 
Total Posts:  5
Joined:  2008-04-21
 

Thanks but this didn’t work ... however I use a block of type “template_links” where I do get the function getLinks() which SEEMS to work (somehow) in the out-of-the-box example of magento but in my version the array of links has no elements (count = 0). I’m beginning to think that there may be a problem within the CMS, is there something that I must do so that the pages I defined in the CMS will be included in that array?

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

getLinks returns links that have been added from the layout files. E.g. in catalogsearch.xml, you see the links “Search Terms” and “Advanced Search” being added to the footer_links block, which is a template_links block.

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

I just tried putting this in 3columns.phtml, and it works:

$collection Mage::getModel('cms/page')->getCollection(); 
$url Mage::getModel('core/url');
foreach (
$collection as $page{
    
echo $url->getBaseUrl() . $page->getIdentifier() . '<br />';
}

It prints out url’s for all cms pages.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top