Java / HTML
  • Hello,

    I have created a new page in the menu. With the online html editer (intergrated in TangoCMS) I can insert HTML lines.
    Now, I want to insert java code. Could someone tell me how? I wanna creat a dorpdown menu into a page. I have tried some scripts and things but it wont work. I dont know where to put the jss file into, because if I creat a page is saves itself into the database and not as a html file.

    Thnx
  • Unfortunately it's not so easy, but there is a way to do it. I'm going to assume here by "Java" you mean "JavaScript".

    Create a file called "init.php" in your themes file, e.g. assets/themes/carbon/init.php now within this, enter the following:
    <?php

    if ( $router->getRawRequestPath() == 'my-page' ) {
    $theme->addJsFile( 'cake.js' );
    }

    ?>

    Then ensure the file assets/js/cake.js exists. That should work
  • I do not understand how to get things working.

    I have created the init.php and de js file into me theme file/folder.
    Now I have a HTML page:

    <script type='text/javascript' src='menu.js'></script>

    <div class='suckertreemenu'>
    <ul id='treemenu1'>
    <li><a href='index.php' style='border-left: 1px solid black'>home</a></li>

    <li><a href='form.php'>contact</a></li>

    <li><a href='gastenboek.php'>gastenboek \/</a>
    <ul>

    <li><a href='gastenboek.php'>gastenboek</a></li>
    <li><a href='toevoegen.php'>schrijf een bericht</a></li>
    </ul>
    </li>

    <li><a href='#'>downloads.php</a></li>

    <li><a href='scripts.php'>tutorials \/</a>
    <ul>

    <li><a href='scriptHTML.php'>Html & Css</a></li>
    <li><a href='scriptJS.php'>Javascript</a></li>
    <li><a href='weergevenTut.php'>Tutorials van gasten ></a>
    <ul>
    <li><a href='WeergevenTuT.php'>Tutorials van gasten</a></li>
    <li><a href='AddTut.php'>Add tutorial</a></li>

    </ul>
    </li>
    </ul>
    </li>

    And a JS file:

    var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

    function buildsubmenus_horizontal(){
    for (var i=0; i<menuids.length; i++){
    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
    ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
    ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
    }
    else{ //else if this is a sub level menu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
    }
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
    }
    }

    if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
    else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)



    <li><a href='about.php'>About</a></li>
    </ul>
    <br style='clear: left;' />
    </div>

    What do I do with that? Normaly I put these 2 files into a file/folder. Now I have to insert the html into the database, and put me js file???

    I hope you could help me again.
    thnx already

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion