共计 1549 个字符,预计需要花费 4 分钟才能阅读完成。
特大利好消息:现在已经可以用相同的接口来访问Skin和Library文件了。所以,现在你再也不用在head block中引用这些文件前去分辨他们了!因此,为了能够使用特定的addCss和addJs特性方法,\Magento\Page\Block\Html\Head::addItem这种型式已经被抛弃了。
Change | Was in Magento 1.x | Became in Magento 2.x |
RSS Layout Instruction |
[php]<reference name="head"> |
[php]<reference name="head"> <action method="addRss"> <title>RSS Feed</title> <file>feed.xml</file> </method> </reference>[/php] |
CSS Layout Instruction |
[php]<reference name="head"> |
[php]<reference name="head"> |
JavaScript Layout Instructions |
[php]<reference name="head"> |
[php] <reference name="head"> |
RSS PHP Call |
[php]$headBlock->addItem( |
[php]$headBlock->addRss( |
CSS PHP Call |
[php]$headBlock->addItem( |
[php]$headBlock->addCss(‘style.css’)[/php] |
JavaScript PHP Call |
[php]$headBlock->addItem( |
[php]$headBlock->addJs(‘script.js’)[/php] |
各位,准备好Magento 2的到来吧!