Topic: Main.tpl and inserting onload .js aswell as div and style of div

I'm working on a extension that puts a dropdown menu on my site. See here for working example. Some of the .js I'm already calling via extension manifest.xml. However main.tpl remains my issue.

The first and last line are what is already in main.tpl ... there's also body tag, but I'm adding the onload of the ajax and then the div and the script....

My question: What would the elegant way be to do this all via the extension?

</head>
<body onload="initMenu()">
<div style= "left: 68px; top: 6px; position: absolute; border: 0px;">
<div id="menuObj"></div>
</div> <div class="content">

<script>
    var menu;
    function initMenu() {
        menu = new dhtmlXMenuObject("menuObj");
        menu.setIconsPath("http://forum/extensions/dhtmlx_menu/ajx/samples/common/imgs/");
        menu.loadXML("http://forum/extensions/dhtmlx_menu/ajx/samples/common/dhxmenu.xml?etc="+new Date().getTime(),function(){
            // menu.addNewSeparator("file");
        });
    }
</script>
 </div>
<div id="brd-wrap" class="brd">

2

Re: Main.tpl and inserting onload .js aswell as div and style of div

Or... you could use jQuery and do it (imo) nicer-looking (with animation), easier (no "onload" in <body>), cleaner (don't forget about people who doesn't use JS) smile

Just check documentation or one web i tried it on  smile

Eraversum - scifi browser-based online webgame

Re: Main.tpl and inserting onload .js aswell as div and style of div

I like the feel and ease of adding images etc to that one I used ... plus you don't have to click to make it drop down big_smile. But I have used that kind of script you did (hideshow)...

What is very cool is how you've done the album with pictures - lightbox/slimbox effect? Or what are you using there to make the images larger? There's an extension here that does something like that
http://punbb.informer.com/forums/topic/ … n-slimbox/

4

Re: Main.tpl and inserting onload .js aswell as div and style of div

KeyDog wrote:

Or what are you using there to make the images larger?

It's one of lightbox clones - this one is pirobox. I like colorbox as well, but I had some problems using images with url like img.php?t=img&id=2104 smile

Eraversum - scifi browser-based online webgame