Results 1 to 14 of 14

Thread: How to include mootools?

  1. #1
    User
    Join Date
    06-20-10.
    Posts
    64

    Default How to include mootools?

    Hi all,

    What javascript code snippet do I need to include into my page.tpl file in order to make it support mootools?

    I have tried searching the forum, but could not find what I am looking for.

    Thank you

  2. #2
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    Or this is what I have done:

    Added a new element: Accordion (single)

    Gave it a header name and added some text.

    In the page layout settings I enabled moo_accordion

    But when I view the page in the frontend, the header text and the body text appear and there is no accordion effect.

    I'm sure I am missing something, but at this point I am unsure what it is.

  3. #3
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    I tried adding this to the <HEAD> section of my page template but it didn't work:

    Code:
    <script type="text/javascript">
    <![CDATA[//><!--
    window.addEvent('domready', function() {
      new Accordion($$('div.toggler'), $$('div.accordion'), {
        alwaysHide: true,
        opacity: false
      });
    });
    //--><!]]>
    </script>

  4. #4
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: How to include mootools?

    You don't need to add anything to the template.

    Mootools core/more is automatically added to the head, and if you select moo_accordion in the page layout, the file "moo_accordion.tpl" will get inserted before the body close tag.

    If it's not working for you, post a URL to an example page where it isn't working and we'll take a look.
    Brian

  5. #5
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: How to include mootools?

    I guess there's a problem with the MooTools framework scripts.

    Have you modified the standard page template "fe_page.tpl"?
    Contao Community Moderator
    → Support options

  6. #6
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    Yes, a completely new template was created for me.

    I assume whatever code snippet that is required by mootools to work has been taken out.

    Anyone know what the default code is?

  7. #7
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: How to include mootools?

    This is the default page template code: http://dev.contao.org/projects/typoligh ... e_page.tpl
    Contao Community Moderator
    → Support options

  8. #8
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    Thanks very much, and do you know where the actual mootools framework files are stored in the file structure of contao? I think those were removed as well because after adding all mootools relevant code sections to my template still nothing happens.

  9. #9
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: How to include mootools?

    Quote Originally Posted by partisanentity
    Do you know where the actual mootools framework files are stored in the file structure of contao?
    "plugins/mootools"

    I would recommend running the Contao System Check Tool to check whether some core files are missing or corrupt.
    Contao Community Moderator
    → Support options

  10. #10
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    Sorry for the confusion, all files are in the right place.

    But what I noticed is that when I view the html...

    There is nothing where this tag is supposed to be:

    Code:
    <?php echo $this->mooScripts; ?>
    Otherwise with this tag:
    Code:
    <?php echo $this->mootools; ?>
    It displays this:


    Code:
    <script type="text/javascript" src="plugins/mediabox/js/mediabox.js"></script>
    <script type="text/javascript">
    <![CDATA[//><!--
    Mediabox.scanPage = function() {
      var links = $$("a").filter(function(el) {
        return el.rel && el.rel.test(/^lightbox/i);
      });
      $$(links).mediabox({/* Put custom options here */}, null, function(el) {
        var rel0 = this.rel.replace(/[[]|]/gi," ");
        var relsize = rel0.split(" ");
        return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1]));
      });
    };
    window.addEvent("domready", Mediabox.scanPage);
    //--><!]]>
    </script>
    
    <script type="text/javascript">
    <![CDATA[//><!--
    window.addEvent('domready', function() {
      new Accordion($$('div.toggler'), $$('div.accordion'), {
        alwaysHide: true,
        opacity: false
      });
    });
    //--><!]]>
    </script>
    So it seems the only issue I am having now is that nothing gets displayed with this tag:
    Code:
    <?php echo $this->mooScripts; ?>

  11. #11
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: How to include mootools?

    First of all, it's always a good idea to indicate the version number from the system you're talking about. It looks like you have an older Contao installation...
    Contao Community Moderator
    → Support options

  12. #12
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    I have 2.8.3, sorry for not having mentioned this earlier.

  13. #13
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,287

    Default Re: How to include mootools?

    Ah, ok, then of course
    Code:
    <?php echo $this->mooScripts; ?>
    does not work!

    The page template for version 2.8.3 looks like this: http://dev.contao.org/projects/typoligh ... e_page.tpl

    And here you find the System Check Tool for version 2.8.3: http://www.contao.glen-langer.de/System ... .8.3.0.zip
    Contao Community Moderator
    → Support options

  14. #14
    User
    Join Date
    06-20-10.
    Posts
    64

    Default Re: How to include mootools?

    Okay I think there is an incompatibility with some of the scripts on my page because I tested the default fe_page.tpl and the accordion worked.

    But when I test the accordion on my default template it doesn't work.

    I'm going to make a copy of the template I use, and slowly start eliminating sections until the accordion works.

    I will post back.

    Thanks very much for your help so far xchs

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •