我在Magento具有延伸部的頂部上增加了一個塊中的報頭,用於加載的jQuery與塊添加的jQuery:在頭部
<reference name="head">
<block type="page/html"
template="csdev/embedjquery/embed_jquery.phtml"
output="toHtml"
name="csdev_embedjquery" />
</reference>
塊的內容如下:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js" />
<script type="text/javascript">
$.noConflict();
alert(jQuery);
</script>
問題是,原型後jQuery將被添加太晚。它需要在原型之前添加,所以我可以執行noConflict()
函數。
而且,由於我不希望覆蓋Magento的頭部模板或Magento的頭塊,我增加了以下內容:
output="toHtml"
但爲時已晚:(...
有作爲"add this block on top of the reference (head) with output='toHtml'"
這樣的解決方案
我想:
before="-"
但它似乎沒有工作,因爲我寫道:
output="toHtml"
我的Magento版本是1.7。
感謝您的回覆!但是,我會改變一個magento系統文件。也不會是從「jQuery.noConflict()」方法執行。所以它會與原型發生衝突。 –