Hello, I'm using wavesurfer in a site, so have included it at the bottom of layout.html.
<!-- The javascript --> <script src="{{=URL('static','js/bootstrap.min.js')}}"></script> <script src="{{=URL('static','js/web2py-bootstrap3.js')}}"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/wavesurfer.js/1.0.52/wavesurfer.min.js"></script> But then one of my views has javascript code to setup a wavesurfer player. This is currently included at the bottom of the view - note that it includes some web2py expressions to populate variables. <!-- The javascript =============================== --> <script type="text/javascript"> var wavesurfer = WaveSurfer.create({ container: '#waveform', }); wavesurfer.load("{{=URL('static', record.static_filepath)}}"); </script> It doesn't work, but I think for the simple reason that the script in the view is included ahead of the scripts loaded in the layout (the contents of the view all gets stuck inside {{include}} in the layout, right?). If I put copy those layout javascript lines into the view ahead of my local inline script, then it works. However, I don't think I want pages loading the same javascript twice, so now I have to load those javascript files at the end of every view. Is there a canonical way to handle this? Do blocks allow me to split insert the contents of a view into different parts of the layout? Or am I better off turning the script into a static JS file that all pages load and adding a simple order-agnostic javascript to define the java variables. Many thanks, David -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.