Magento: Add external javascript or css reference link through layout xml
Use case: You want to add a jQuery UI and its css library in the head tag by referencing a cdn link in Magento.
Given: You have a layout update xml file, helloworld.xml, and in the hellowworld.xml file, you have an update handler
Code:
<hellowrold_index_index> <reference name="head"> <block type="core/text" name="google.jquery.cdn"> <action method="setText"> <text><![CDATA[ <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" /> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> ]]></text> </action> </block> </reference> </helloworld_index_index>
To include local javascript file or css file, see this post.
Search within Codexpedia
![Google](https://www.google.com/images/poweredby_transparent/poweredby_FFFFFF.gif)
Custom Search
Search the entire web
![Google](https://www.google.com/images/poweredby_transparent/poweredby_FFFFFF.gif)
Custom Search
Related Posts