Skip to content

Instantly share code, notes, and snippets.

@jacquesbh
Last active December 10, 2015 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacquesbh/4365871 to your computer and use it in GitHub Desktop.
Save jacquesbh/4365871 to your computer and use it in GitHub Desktop.
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