Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Specify CMS pages in the cms.xml
 
therealro
Sr. Member
 
Total Posts:  102
Joined:  2010-04-09
 

Hi all,

I was wondering if there is a way i can specify cms pages in the cms.xml file.

Example:

<cms_page>
        <
reference name="content">
               ...
blocks...
        </
reference>
    </
cms_page>

The above code is default in the cms.xml.

I would like to do something like this:

<cms_page name="Contact">
        <
reference name="content">
               ...
blocks...  
        </
reference>
    </
cms_page>

notice: name="Contact”.

So i can change every cms page how i want.

I know i can do this in the backend --> CMS page --> Design -->Layout Update XML but i would rather do this in the XML.

Can anyone help me with this?

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Martin H
Member
 
Total Posts:  36
Joined:  2009-06-26
Buenos Aires, Argentina
 

Needed too, therealro!

 
Magento Community Magento Community
Magento Community
Magento Community
 
venone_ch
Jr. Member
 
Total Posts:  3
Joined:  2010-03-01
 

** push ** exactly what I do need as I’m working with local.xml - file.

How to refer to a specific CMS - Page out of an *.xml - file?

 
Magento Community Magento Community
Magento Community
Magento Community
 
English87
Sr. Member
 
Total Posts:  80
Joined:  2009-08-12
 

I too am interesting in using layout xml to update cms page content.

This page shows some a list of handles used (at the time), and a Magento team members states that the handles follow the convention of module_controller_action.

I’d imagine the module is ‘cms’ and the controller is the page name e.g. ‘about-us’. I’ve no idea what the action is.

This works to append a block to the content area of the home page:

<cms_index_index>
  <
reference name="content">
    <
block type="core/template" template="cms/about_us.phtml" />
  </
reference>
</
cms_index_index>
However, each of the following does not have any effect on my ‘about-us’ cms page:
<cms_about-us_index>
    <
reference name="content">
        <
block type="core/template" template="cms/about_us.phtml" />
    </
reference>
</
cms_about-us_index>
<cms_index_about-us>
    <
reference name="content">
        <
block type="core/template" template="cms/about_us.phtml" />
    </
reference>
</
cms_index_about-us>
<cms_about-us>
    <
reference name="content">
        <
block type="core/template" template="cms/about_us.phtml" />
    </
reference>
</
cms_about-us>
So I’m out of ideas here, can anybody shed any light on this? Using xml files to specify the contents of cms pages is much easier to maintain as I hate having to update my dev site pages through the admin and then do the same to update the live site.
 
Magento Community Magento Community
Magento Community
Magento Community
 
English87
Sr. Member
 
Total Posts:  80
Joined:  2009-08-12
 

I’ve stumbled across this post and it seems that Magento doesn’t define handles for cms pages, with the index page being a special case. Alan Storm’s LayoutViewer Module mentioned in the post is really handy in showing the xml layout make-up of pages.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Script Kiddi3
Jr. Member
 
Total Posts:  18
Joined:  2010-05-24
Rawalpindi
 

Hello Sir,

You can add your phtml file to every cms page using this

<cms_page translate="label">

<
reference name="content">

<
reference name="cms.wrapper">
<
block type="web-designz/web-designz" name="web-designz" template="web-designz/cms_web-designz.phtml"/>
</
reference>
</
reference>
</
cms_page>

Thanks,
Regards smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
yrcrz
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2011-10-29
 

For those of you still confused about this, you may not add CSS via your local.xml but you may add it in the CMS page itself.

Go to your CMS page and under the Design tab add the following code:

<reference name="head">
     <
action method="addCss"><stylesheet>css/your-css-file.css</stylesheet></action>
</
reference>

This of course is referencing a CSS file in skin/frontend/my_interface/my_theme/css (if you’re using a custom theme). Hope that helps someone.

 
Magento Community Magento Community
Magento Community
Magento Community
 
G_Mehta
Guru
 
Avatar
Total Posts:  418
Joined:  2010-01-27
India
 

I had developed module to achieve same thing.
Have a look demo:

http://mehtagaurav.blogspot.com/2011/11/magento-navigation-menu-of-cms-pages.html

PM me for quick reply.

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
tnchuntic
Jr. Member
 
Total Posts:  1
Joined:  2009-06-10
 

Just use the name of the page:

example:
page: news
xml code should be:

<news_index_index>
...block…
</news_index_index>

That’s it.

Hope it help. smile

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