易截截图软件、单文件、免安装、纯绿色、仅160KB

magento 开发 另一种方式用xml来布局

是否厌倦了用xml文件来做Magento的页面布局,是的话来试试下面这种方式,把布局代码写到controller 里面
public function mycoolAction()
{
/* ... Some code ...*/
$update = $this->getLayout()->getUpdate();
/* ... Some code ...*/
$this->addActionLayoutHandles();
/* ... Some code ...*/
$this->loadLayoutUpdates();
/* ... Some code ...*/
/* My stuff, add pure XML like you do from XML layout files <img src="http://inchoo.net/wp-includes/images/smilies/icon_smile.gif" mce_src="http://inchoo.net/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley"> */
$update->addUpdate('
<reference name="head">
<action method="addJs"><mce:script type="text/javascript"><!--
varien/product.js
// --></mce:script></action>
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params /><!--<if/><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if /><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if /><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>skin_js</type><name>js/bundle.js</name></action>
</reference>
');
/* ... Some code ...*/
$this->generateLayoutXml()->generateLayoutBlocks();
/* ... Some code ...*/
$this->renderLayout();
}
这样你也许就可以少新建一些xml文件
当然,这里还是推荐把布局写在xml文件里,上面这种方式只是告诉你Magento还有另一种方式来实现相同的功能


相关文档:

xml jboss problem

the content of element type "jboss" must matched  loader-respository ,jmx-name,enforce-ejb-restriction,
security-domain,missing-method-permission-excluded-mode,unauthenticated-principal,exception-on-rollback,
webservices,enterprice-beans,assembly-descriptor,resource-managers,invoker-proxy-bin ......

java读取xml配置文件

xml文件如下 配置功能开关
<Configurations>
    <Samples>true</Samples>
    <Excepts>true</Excepts>
    <CheckFace>false</CheckFace>
    <ThumbNail>false</ThumbNail>
  &nbs ......

在Visual C#中使用XML指南之读取XML

我们今天来讲一下该体系结构中的XmlTextReader类,该类提供对Xml文件进行读取的功能,它可以验证文档是否格式良好,如果不是格式良好的Xml文档,该类在读取过程中将会抛出XmlException异常,可使用该类提供的一些方法对文档节点进行读取,筛选等操作以及得到节点的名称和值,请牢记:XmlTextReader是基于流模型的实现,打个 ......

xml + xsl pagination

page.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="page.xsl" ?>
<list>
 <item>1</item>
 <item>2</item>
 <item>3</item>
 <item>4</item>
 <item>5</item>
& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号