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Îļþ×÷ΪÊý¾ÝÊý¾Ý´æ´¢½éÖʵÄÒ»ÖÖ£¬ºÃ´¦ÔÚÓÚ£ºÈκεÄϵͳ¾ù¿ÉÒÔ½âÎöËü¡£
XMLÈ«³Æ£ºExtensible Markup Language£¨À©Õ¹±ê¼ÇÓïÑÔ£©Ê¹ÓÃÎĵµÀàÐͶ¨Ò壨DTD£©»òÕßģʽ£¨Schema£©À´ÃèÊöÊý¾ÝµÄ¡£¿É¹©ÈËÔĶÁ£¬¶øÇÒ»¹»ùÓÚÒ»ÖÖ¹«¹²µÄ¿ª·¢±ê×¼¡£
×î½üÓÉÓÚ¿ª·¢µÄÐèÒª£¬Ò²ÊÇÑо¿ÒÔÏÂXMLµÄ²Ù×÷£¬±¾ÆªÈÕÖ¾Ö÷Òª×ܽáC#.NETÖÐÊÇÈçºÎ²Ù×÷XM ......
×÷ÕߣºÖì½ð²Ó
À´Ô´£ºhttp://blog.csdn.net/clever101/
ÏÖÔÚÎÒ·¢ÏÖʹÓÃVisual StudioµÄ×ÊÔ´±à¼Æ÷½øÐбà¼×ÊÔ´ÓÐ×ÅÖî¶àµÄ²»±ã£ºÊ×ÏÈÊÇÈκÎ×ÊÔ´µÄ±ä¶¯Ò»°ã±ä¶¯´úÂ룬²»ÀûÓÚϵͳά»¤£¬Æä´ÎVisual StudioµÄ×ÊÔ´±à¼Æ÷µÄ±¾ÉíµÄ¹¦ÄÜÓÐÏÞ£¬Ò²²»ÀûÓÚ½çÃæÃÀ»¯£¬ÈýÊDz»ÀûÓÚÈËÔ±·Ö¹¤£¬¿ª·¢ÈËÔ±¼ÈҪæ ......
XML ÃüÃû¿Õ¼ä¿ÉÌṩ±ÜÃâÔªËØÃüÃû³åÍ»µÄ·½·¨¡£
ÃüÃû³åÍ»
ÓÉÓÚ XML ÖеÄÔªËØÃûÊÇÔ¤¶¨ÒåµÄ£¬µ±Á½¸ö²»Í¬µÄÎĵµÊ¹ÓÃÏàͬµÄÔªËØÃûʱ£¬¾Í»á·¢ÉúÃüÃû³åÍ»¡£
Õâ¸ö XML ÎĵµÐ¯´ø×Åij¸ö±í¸ñÖеÄÐÅÏ¢£º
<table>
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</ta ......
ÔںܶàÑÐÌÖ»áºÍÅàѵ°àÉÏÎÒÓöµ½¹ýÐí¶àÈË£¬ËûÃÇ»¹²»Ã÷°×ΪʲôҪʹÓÃXMLÒ²²»ÖªµÀÈçºÎÔÚËûÃǵÄÓ¦ÓÃÖÐʹÓÃXML¡£Ò»Ð©À´×ÔÖîÈçGartner¹«Ë¾µÄ±¨¸æ½¨Òé˵£¬ÉÌÒµ¹«Ë¾²»ÄÜÔÙ×ö¾ÖÍâÈËÁË£¬²»ÄܶÔXMLÖÃÖ®²»Àí¡£Èç¹ûÄ㻹²»Çå³þXMLµ½µ×ÓÐʲôºÃ´¦µÄ»°£¬Äã²¢²»ÊÇΨһµÄÈË¡£
ÎÒ¾ö¶¨°ÑÓëÈËÃǺÍýÌå¹ØÓÚXML»°ÌâµÄ½»Ì¸ÕûÀí³ÉÎÄ£¬ÁгöXMLÔÚÓ¦ÓÃÖ ......