views:

1212

answers:

1

Hi all!

I've added several pages (cms) in my magento admin panel. I know i can attach blocks to a specific page by using {{block..}} within the content field.

However, i dont want to define blocks there, but within the cms.xml file. So other store admins are not annoyed by weird codes ({{block..}}) in the backend editor.

I've defined the index/home page with the following xml tag:

<cms_index_index>
    <reference name="content">
        <block... />
    </reference>
</cms_index_index>

The question; how can i define other cms pages (by id or seo-identifier) within cms.xml I've tried defining them by;

<cms_page_[seo-ident]>
<cms_pageid_[id]>
<cms_[seo-ident]>
<cms_[id]>

This didnt work. I cant figure it out..

// Roland

+2  A: 

I'm not super familiar with the CMS module, but I can tell you how to get the XML tag/handle (cms_index_index) for any page in your system.

You should now see a list of "handles". Handles are used to identify particular requests. For example cms_index_index is the handle that identifies a request for the CMS module's index action on the its index controller. You should see similar handles on your other CMS pages.

If this works post a follow up in the comments, I'm curious how the CMS handles are formed and haven't had time to search it out.

Update: I've done this on a testbed install of Magento that I have kicking around. I created a simple CMS page available at the following URL

http://example.com/index.php/this-is-my-identifier

And I got the following handles

  1. default
  2. cms_page
  3. STORE_default
  4. THEME_frontend_default_default
  5. cms_page_view
  6. page_one_column
  7. customer_logged_out

So, based on this, it looks like Magento doesn't create an individual handle for each CMS page (I'm kind of surprised the cms_index_index you mentioned above works ... which means there's probably something going on I don't quite understand).

So, what I'd try to do is define your blocks within a <cms_page> or <cms_page_view> tag. That should make them available to all your CMS pages.

Alan Storm