开发者

How would you generate the Magento Layout XML outside of Magento?

开发者 https://www.devze.com 2023-02-07 22:12 出处:网络
I want to be able to provide template, block details from the layout file generated by Magento.the same information which can be seen if you install Alan Storm\'s excellent layoutviewer and print out

I want to be able to provide template, block details from the layout file generated by Magento. the same information which can be seen if you install Alan Storm's excellent layoutviewer and print out the all the xml to screen. (The Package Layout is what I am after, which is a large XML file that contains every possible layout conf开发者_StackOverflowiguration for a particular Magento install.)

I have been struggling to get this data from a script which i am running in the application directory alongside the index.php file.

How can I get the full layout XML in an xml document without installing any custom module installation?


Mage::app()->getLayout()->getUpdate()->load("default")->asString();

This piece of code will give you layout xml for given handle, still there exists need to scan layout files to find all handles to generate full xml.


I haven't tried it but at first glance I would think it should be

Mage::getSingleton('core/layout')->getXmlString()


The best and easiest way I can think of getting the XML layout is by writing a Magento extension that gets the info and presents it or exports it programmatically. Otherwise, you will have to recreate the Magento logic of combining all the XML files, etc. which will result in larger code base.


use 'Configviewer' and 'Layoutviewer'  
http://www.abc.com/index.php/index/index?showLayout=package
http://www.abc.com/index.php/index/index?showLayout=handles
http://www.abc.com/index.php/index/index?showConfig=true
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号