Skip to content

Instantly share code, notes, and snippets.

@jacquesbh
Last active Dec 10, 2015
Embed
What would you like to do?
Ajouter un script externe au header sur Magento (http://jacques.sh/ajouter-un-script-externe-au-header-sur-magento.html)
<block type="core/text" name="head.jquery">
<action method="setText">
<text><![CDATA[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>]]></text>
</action>
</block>
<?php
$text = "Hello World!";
$block = Mage::app()->getLayout()->createBlock('core/text')->setText($text);
<?php
$text = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>';
$block = Mage::app()->getLayout()->createBlock('core/text')->setText($text);
<?xml version="1.0" encoding="utf-8" ?>
<layout version="0.1.0">
<default>
<reference name="head">
<block type="core/text" name="head.jquery">
<action method="setText">
<text><![CDATA[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>]]></text>
</action>
</block>
</reference>
</default>
</layout>
<?xml version="1.0" encoding="utf-8" ?>
<layout version="0.1.0">
<default>
<reference name="head">
<block type="core/text" name="head.base_url">
<action method="setText">
<text><![CDATA[<script type="text/javascript">var BASE_URL = '{{baseUrl}}';</script>]]></text>
</action>
</block>
</reference>
</default>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment