Create a folder called js in your module folder (this is to make it easier in your xml file, and to keep things nice.)
Than you create a js file in that folder name it whatever makes sense, and in your module file mod_david_table.php Add JHTML::_('script', 'nameoffile.js' 'modules/mod_david_table/js/'); Please check that for typos I typed it on my phone. On Aug 1, 2012 7:40 AM, "David Roth" <davidalanr...@gmail.com> wrote: > Thanks, Chris & Donna for your postings. Very helpful! > > I got it working as a module. > > Now that this is a big requirement for this module, but I was wondering > how do I take the JavaScript and put it in it's own file so that the module > can find it? Thanks! > > David Roth > > > On Tue, Jul 31, 2012 at 4:19 PM, Christopher French < > cont...@chrisfrench.me> wrote: > >> Your probably best to just make your own module. >> >> Make a module in joomla is very easy it is the easiest thing to make. >> >> You could just copy a module xml from another folder or download a hello >> world module. >> >> At the most basic level you could just copy an xml file from any module >> than, >> >> Put in a folder name it mod_david_table.xml open it up and change the >> info to yours >> >> Create an empty file called mod_david_table.php in the same folder and >> just copy all you html and javascript right into that file and just have no >> php. As you learn you can update your module to use templates helpers and >> caching if you want. >> >> That is better than disabling js in your wysiwg editor. >> >> Last sstep is you zip of your two files and install them >> >> On Tue, Jul 31, 2012 at 5:42 AM, Donna Marie Vincent < >> donnamarievinc...@yahoo.com> wrote: >> >>> 1. You can set your editor to *not* filter out the javascript. >>> >>> 2. It is very easy to create a simple module and put your code in it. >>> (I have a tutorial for it but it's not updated for 2.5. The main >>> difference is that you now need to register modules in the database in the >>> #__extensions table.) There are probably up-to-date tutorials on YouTube >>> for doing this. Once you see how easy it is, you won't both spending time >>> looking for extensions that fit, you'll just make your own! >>> >>> >>> >>> ------------------------------ >>> *From:* David Roth <davidalanr...@gmail.com> >>> *To:* NYPHP SIG: Joomla <joomla@lists.nyphp.org> >>> *Sent:* Tuesday, July 31, 2012 6:54 AM >>> *Subject:* [joomla] Converting a HTML/JavaScript page to be a module in >>> Joomla >>> >>> I have a JavaScript program which does some simple calculations. It >>> emulates what you would do in a spreadsheet. It isn't fancy, but it is >>> functional and I want to make a Joomla module out of it. I didn't write a >>> CSS for this because it was intended to be used in Joomla from the start >>> and I want it to inherit the Joomla CSS that's resident. >>> >>> My first thought was, create a custom HTML module, go into HTML editing >>> mode and paste the HTML page with it's JavaScript in there. >>> >>> The result is, it didn't work. It kept the HTML formatting of the page, >>> but it filtered out all the JavaScript. There are no external files >>> referencing the JavaScript and jQuery is not being used. Maybe it needs to >>> be an actual mod_david_calc and that will do it? But I must be missing >>> something else in order to do that. Can't imagine getting away from free in >>> Joomla without having to call some Joomla function to make it work. :-) >>> >>> So then I spent time searching and it appears some sort of special >>> treatment is needed for your own JavaScript to be available in Joomla. >>> >>> Why I'm posting about this, is that I would like to get some direction >>> as to what is the best way to do this. Is there a favorite Joomla extension >>> people use to help make all this happen? Also, should it be a module or >>> can/should it be a Joomla Article for this JavaScript calc program? It only >>> needs to appear on one page. Thanks! >>> >>> David Roth >>> >>> _______________________________________________ >>> New York PHP SIG: Joomla! Mailing List >>> http://lists.nyphp.org/mailman/listinfo/joomla >>> >>> NYPHPCon 2006 Presentations Online >>> http://www.nyphpcon.com >>> >>> Show Your Participation in New York PHP >>> http://www.nyphp.org/show_participation.php >>> >>> >>> _______________________________________________ >>> New York PHP SIG: Joomla! Mailing List >>> http://lists.nyphp.org/mailman/listinfo/joomla >>> >>> NYPHPCon 2006 Presentations Online >>> http://www.nyphpcon.com >>> >>> Show Your Participation in New York PHP >>> http://www.nyphp.org/show_participation.php >>> >> >> >> _______________________________________________ >> New York PHP SIG: Joomla! Mailing List >> http://lists.nyphp.org/mailman/listinfo/joomla >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > > > _______________________________________________ > New York PHP SIG: Joomla! Mailing List > http://lists.nyphp.org/mailman/listinfo/joomla > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php >
_______________________________________________ New York PHP SIG: Joomla! Mailing List http://lists.nyphp.org/mailman/listinfo/joomla NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php