0

Can anyone list the steps to insert edge animate on a page in Magento 1.9. I can do it in an ordinary website but no luck here.Do I have to declare the js in an xml file or files?i can insert the stage div and insert the runtime stuff in the head ,its the js bit I'm stuck on. Thanks.

1 Answer 1

4

You should make a module.

To insert the js for Edge Animate, you need to keep the Adobe Edge Runtime comments in place. So, instead of doing a simple insert in the js inserts section of your xml, you need to load a block that loads a template that contains the comments and js import. Bright side is you could reuse this module for all of your Edge inserts with some mods.

Assuming it's called InsertEdge, the module would be like so:

app/code/local/YourName/InsertEdge/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <YourName_InsertEdge>
            <version>0.1.0</version>
        </YourName_InsertEdge>
    </modules>
    <global>
        <blocks>
            <yourname_insertedge>
                <class>YourName_InsertEdge_Block</class>
            </yourname_insertedge>
        </blocks>
    </global>
    <frontend>
        <layout>
            <updates>
                <yourname_insertedge>
                    <file>insertedge.xml</file>
                </yourname_insertedge>
            </updates>
        </layout>
    </frontend>
</config>

app/code/local/YourName/InsertEdge/Block/HeadInsert.php

<?php

class YourName_InsertEdge_Block_HeadInsert extends Mage_Core_Block_Template
{
    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('insertedge/headinsert.phtml');
    }
}

app/design/frontend/your_interface/your_theme/layout/insertedge.xml

<?xml version="1.0"?>
<!DOCTYPE layout>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <block type="insertedge/headinsert"/>
        </reference>
    </default>
</layout>

app/design/frontend/your_interface/your_theme/template/insertedge/headinsert.phtml

<!--Adobe Edge Runtime-->
<script type="text/javascript" charset="utf-8" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)?>edgeinsert/yourid-xxxxxxxx_edgePreload.js"></script>
<style>
    your edge style code here
</style>
<!--Adobe Edge Runtime End-->

In the your_magento_directory/js directory, make a directory called insertedge, and put the Adobe js in there.

app/etc/modules/YourName_InsertEdge.xml

<?xml version="1.0"?>
<config>
    <modules>
        <YourName_InsertEdge>
            <active>true</active>
            <codePool>local</codePool>
        </YourName_InsertEdge>
    </modules>
</config>

There are better guides out there for making and installing custom modules than I would make, so if you haven't done that before I would give that a quick Googling and find a tutorial you like.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.