Put var $helpers = array('Javascript'); in your app_controller.php Also make sure the moo.fx files are at the right place. Moo.fx is cool. Have fun.
martin wrote: > I'm just getting started with JavaScript and I really like the moo.fx > accordion effect, but I'm having some problems getting moo.fx to work. > > At first I thought the problem might be with the website I am > developing, so I put all of that in a temporary folder and extracted > cake 1.1.4.3104 into my server root. After configuring, I create the > following three files: > > > --app/views/layouts/default.thtml-- > > <html> > <head> > <?php echo $javascript->link('prototype')?> > <?php echo $javascript->link('moo.fx')?> > <?php echo $javascript->link('moo.fx.pack')?> > </head> > <body> > <?php echo $content_for_layout?> > </body> > </html> > > > > --app/controllers/asdf_controller.php-- > > <?php > class AsdfController extends AppController > { > var $uses = array(); > var $helpers = array('Javascript'); > function index() > { > ; > } > } > ?> > > > > --app/views/asdf/index.thtml-- > > <h1>Hello World!</h1> > <a class="stretchtoggle">Hello World</a> > <div class="strecher"> > Accordion Text 1 > </div> > <a class="stretchtoggle">Hello World 2</a> > <div class="strecher"> > Accordion Text 2 > </div> > > <script type="text/javascript"> > var myDivs = document.getElementsByClassName('stretcher'); > var myLinks = document.getElementsByClassName('stretchtoggle'); > var myAccordion = new fx.Accordion(myLinks, myDivs, {opacity: true}); > </script> > > > Firefox gives me the following 3 javascript errors: > > (1) > Error: unexpected end of XML source > Source File: http://127.0.0.1/js/moo.fx > Line: 5, Column: 163 > Source Code: > <b>Fatal error</b>: Call to a member function on a non-object in > <b>C:\Program > Files\xammp\xampp\htdocs\app\views\layouts\default.thtml</b> on line > <b>3</b><br /> > > And moo.fx looks like this when I click on the link to in in the > firefox error console: > > <html> > <head> > <br /> > <b>Fatal error</b>: Call to a member function on a non-object in > <b>C:\Program > Files\xammp\xampp\htdocs\app\views\layouts\default.thtml</b> on line > <b>3</b><b > > > (2) > Error: unexpected end of XML source > Source File: http://127.0.0.1/js/moo.fx.pack > Line: 5, Column: 163 > Source Code: > <b>Fatal error</b>: Call to a member function on a non-object in > <b>C:\Program > Files\xammp\xampp\htdocs\app\views\layouts\default.thtml</b> on line > <b>3</b><br /> > > And moo.fx.pack looks like this when I click on the link to in in the > firefox error console: > > <html> > <head> > <br /> > <b>Fatal error</b>: Call to a member function on a non-object in > <b>C:\Program > Files\xammp\xampp\htdocs\app\views\layouts\default.thtml</b> on line > <b>3</b><br /> > > > (3) > Error: fx is not defined > Source File: http://127.0.0.1/asdf/index/ > Line: 18 > > > I am assuming that this all means that moo.fx is trying to generate a > page, and this is causing errors with cake... does anyone know how to > work around this and get it working? Am I doing something wrong? I've > tried adding the javascript links in the view file, instead of in the > layout, but that didn't help either, and I haven't had this problem > linking other js libraries. Thanks in advance! > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---