+ Antworten
Ergebnis 1 bis 4 von 4

Thema: MooTree einbinden

  1. #1
    Neu an Board Avatar von conny64
    Registriert seit
    02.11.2006
    Beiträge
    55
    Bedankte sich
    1
    Erhielt 3 Danksagungen
    in 3 Beiträgen

    Standard MooTree einbinden

    Ich habe gesehen, dass in Joomla standard mäßig auch die Lib MooTree.js enthalten ist.
    Also habe ich mich auf die Suche nach einer Beschreibung gemacht. Habe dann eine Beschreibung über MooTree gefunden. Soweit so gut. Wenn ich die jetzt in meine Ausgabe (template.php) in mein Modul einbinde, dann bekomme ich es irgendwie nicht zum laufen.

    Ich würde Euch gerne mal ganz, ganz lieb um Hilfe bitten.

    LG Conny

    Also hier mal die original Mootree Demo:
    PHP-Code:
    !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <
    html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">

    <
    head>

    <
    title>mooTree 2</title>

    <
    meta **********="content-type" content="text/html; charset=iso-8859-1" />
    <
    link rel="stylesheet" href="mootree.css" type="text/css" media="screen" />

    <
    script type="text/javascript" src="mootools/mootools-1.2-core.js"></script>
    <script type="text/javascript" src="mootree.js"></script>

    <script type="text/javascript">

    var tree;

    window.onload = function() {
        
        // --- ordinary MooTreeControl example:
        
        tree = new MooTreeControl({
            div: 'mytree',
            mode: 'files',
            grid: true
        },{
            text: 'Root Node',
            open: true
        });
        
        tree.disable(); // this stops visual updates while we're building the tree...
        
        var node1 = tree.insert({text:'Subnode 1', id:'1'});
        var node2 = tree.insert({text:'Subnode 2', id:'2', icon:'sample_icons.gif#1', openicon:'sample_icons.gif#2'});
        var node3 = tree.insert({text:'Subnode 3', id:'3'});
        
        var node1_1 = node1.insert({text:'Subnode 1.1', id:'1.1'});
        var node1_2 = node1.insert({text:'Subnode 1.2', id:'1.2', color:'#ff0000'});
        var node1_3 = node1.insert({text:'Subnode 1.3', id:'1.3'});
        
        var node2_1 = node2.insert({text:'Subnode 2.1', id:'2.1'});
        var node2_2 = node2.insert({text:'Subnode 2.2', id:'2.2', color:'#ff0000'});
        var node2_3 = node2.insert({text:'Subnode 2.3', id:'2.3'});
        
        var node2_2_1 = node2_2.insert({text:'Subnode 2.2.1', id:'2.2.1', color:'#00a000'});
        var node2_2_1_1 = node2_2_1.insert({text:'Subnode 2.2.1.1', id:'2.2.1.1', color:'#0000ff'});
        
        var node4 = tree.insert({text:'Subnode 4', id:'4', icon:'sample_icons.gif#3'});
        
        tree.expand();
        
        tree.enable(); // this turns visual updates on again.
        
    }

    function find_node() {
        var node = tree.get( $('nodeid_input').value );
        window.alert( node ? 'found: ' + node.text : 'not found...' );
    }

    </script>

    </head>

    <body>

    <h2>mooTree 2</h2>
    <h4>example 1: basic tree example</h4>

    <p>
        This demonstrates most of the basic features of MooTree, including enable() and disable() which can be used
        to minimize the number of visual updates performed.
    </p>

    <p>
        This example also demonstrates basic usage of the get() method and node id's - for example, type "2.2" in the
        text input at the bottom of this page, and press "find node".
    </p>

    <div id="mytree">
    </div>

    <p>
        <input type="button" value=" expand all " onclick="tree.expand()" />
        <input type="button" value=" collapse all " onclick="tree.collapse()" />
        <input type="text" value="" id="nodeid_input" value="2.2" /><input type="submit" value="Find node" onclick="find_node()" />
    </p>

    </body>

    </html> 

    Und so habe ich es versucht bei mir einzubinden:
    PHP-Code:
    <?php // no direct access
    defined('_JEXEC') or die('Restricted access');

    // Include mootools framework
            
    JHTMLBehavior::mootools();
            
    JHTML::script('mootree.js');
            
    JHTML::stylesheet('mootree.css');


    $js "
    var tree;

    window.onload = function() {
        
        // --- ordinary MooTreeControl example:
        
        tree = new MooTreeControl({
            div: 'mytree',
            mode: 'files',
            grid: true
        },{
            text: 'Root Node',
            open: true
        });
        
        tree.disable(); // this stops visual updates while we're building the tree...
        
        var node1 = tree.insert({text:'Subnode 1', id:'1'});
        var node2 = tree.insert({text:'Subnode 2', id:'2'});
        var node3 = tree.insert({text:'Subnode 3', id:'3'});
        
        var node1_1 = node1.insert({text:'Subnode 1.1', id:'1.1'});
        var node1_2 = node1.insert({text:'Subnode 1.2', id:'1.2', color:'#ff0000'});
        var node1_3 = node1.insert({text:'Subnode 1.3', id:'1.3'});
        
        var node2_1 = node2.insert({text:'Subnode 2.1', id:'2.1'});
        var node2_2 = node2.insert({text:'Subnode 2.2', id:'2.2', color:'#ff0000'});
        var node2_3 = node2.insert({text:'Subnode 2.3', id:'2.3'});
        
        var node2_2_1 = node2_2.insert({text:'Subnode 2.2.1', id:'2.2.1', color:'#00a000'});
        var node2_2_1_1 = node2_2_1.insert({text:'Subnode 2.2.1.1', id:'2.2.1.1', color:'#0000ff'});
        
        var node4 = tree.insert({text:'Subnode 4', id:'4' });
        
        tree.expand();
        
        tree.enable(); // this turns visual updates on again.
        
    }

    function find_node() {
        var node = tree.get( $('nodeid_input').value );
        window.alert( node ? 'found: ' + node.text : 'not found...' );
    }

    "
    ;

        
    $document =& JFactory::getDocument();
        
    $document->addScriptDeclaration($js);
    ?>
    <div id="mytree">
    </div>

    <p>
        <input type="button" value=" expand all " onclick="tree.expand()" />
        <input type="button" value=" collapse all " onclick="tree.collapse()" />
        <input type="text" value="" id="nodeid_input" value="2.2" /><input type="submit" value="Find node" onclick="find_node()" />
    </p>

  2. #2
    Neu an Board Avatar von conny64
    Registriert seit
    02.11.2006
    Beiträge
    55
    Bedankte sich
    1
    Erhielt 3 Danksagungen
    in 3 Beiträgen

    Standard Gelöst

    Danke - habe es selbst hinbekommen.

    PHP-Code:
        <?php // no direct access
    defined('_JEXEC') or die('Restricted access');

    // Include mootools framework
            
    JHTMLBehavior::mootools();
            
    JHTML::script('mootree.js');
            
    JHTML::stylesheet('mootree.css');

    $js "
    var tree;

    window.onload = function() {
        
        // --- ordinary MooTreeControl example:
        
        tree = new MooTreeControl({
            div: 'mytree',
            mode: 'files',
            grid: true,
            theme: '/media/system/images/mootree.gif'
        },{
            text: 'Root Node',
            open: true
        });
        
        tree.disable(); // this stops visual updates while we're building the tree...
        
        var node1 = tree.insert({text:'Subnode 1', id:'1'});
        var node2 = tree.insert({text:'Subnode 2', id:'2'});
        var node3 = tree.insert({text:'Subnode 3', id:'3'});
        
        var node1_1 = node1.insert({text:'Subnode 1.1', id:'1.1'});
        var node1_2 = node1.insert({text:'Subnode 1.2', id:'1.2', color:'#ff0000'});
        var node1_3 = node1.insert({text:'Subnode 1.3', id:'1.3'});
        
        var node2_1 = node2.insert({text:'Subnode 2.1', id:'2.1'});
        var node2_2 = node2.insert({text:'Subnode 2.2', id:'2.2', color:'#ff0000'});
        var node2_3 = node2.insert({text:'Subnode 2.3', id:'2.3'});
        
        var node2_2_1 = node2_2.insert({text:'Subnode 2.2.1', id:'2.2.1', color:'#00a000'});
        var node2_2_1_1 = node2_2_1.insert({text:'Subnode 2.2.1.1', id:'2.2.1.1', color:'#0000ff'});
        
        var node4 = tree.insert({text:'Subnode 4', id:'4' });
        
        tree.expand();
        
        tree.enable(); // this turns visual updates on again.
    }

    function find_node() {
        var node = tree.get( $('nodeid_input').value );
        window.alert( node ? 'found: ' + node.text : 'not found...' );
    }

    "
    ;

        
    $document =& JFactory::getDocument();
        
    $document->addScriptDeclaration($js);

    ?>

    <div id="mytree"></div>

    <p>
        <input type="button" value=" expand all " onclick="tree.expand()" />
        <input type="button" value=" collapse all " onclick="tree.collapse()" />
        <input type="text" value="" id="nodeid_input" value="2.2" /><input type="submit" value="Find node" onclick="find_node()" />
    </p>

  3. #3
    Verbringt hier viel Zeit
    Registriert seit
    31.05.2008
    Beiträge
    801
    Bedankte sich
    0
    Erhielt 268 Danksagungen
    in 214 Beiträgen

    Standard

    PHP-Code:
    JHTML::_('behavior.tree'$id$params$root); 
    libraries\joomla\html\html\behavior.php Zeile 229

    Dann hast du MooTree eingebunden
    lg Måria

  4. #4
    Neu an Board
    Registriert seit
    02.08.2010
    Beiträge
    1
    Bedankte sich
    0
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard mootree.js

    Hallo conny64!
    Vielleicht kannst du mir weiter helfen, da ich im Forum nicht wirklich auf die Lösung meines Problemes gestoßen bin.

    Habe für meine Homepage (www.post-sv-koblenz.de) die Galerie-Komponente "Zoomgallery" installiert und bei den ersten vier Alben hat auch alles super geklappt (musste zwar Java neu installieren, obwohl es schon drauf war, aber egal).
    Plötzlich erscheint aber im Album Manager eine Fehlermeldung (kann meine bisher angelegten Alben nicht mehr im "Baum" anschauen, wohl aber im Bilder-Manager).
    Die Fehlermeldung lautet:


    Meldung: Objekt erforderlich
    Zeile: 659
    Zeichen: 3
    Code: 0
    URI: http://www.post-sv-koblenz.de/compon.../js/mootree.js

    Bilder kann ich nicht mehr uploaden und ich weiß halt nicht, wie und wo.... ich mootree.js einbinden kann und wieso das bei den ersten Alben geklappt hat und jetzt nicht mehr.

    Vielleicht kannst du mir einen Tipp geben (möglichst "für Dumme", da ich eigentlich keine Ahnung von html habe)

    Das wäre echt super nett!

    Vielen Dank schon mal!
    Klumdai

+ Antworten

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein