[TYPO3-ect] general approach for JS

Steve Ryan stever at syntithenai.com
Wed Sep 12 05:51:37 CEST 2007


* Just whack an include in your TS template at the end
page.1000000000000=TEXT
page.1000000000000.value=<script>include('EXT:jquery/jquery_compressed.js');</script>
     // not sure about include syntax js

* Should be no problem with page loading if activated unobtrusively
page.1000000000001=TEXT
page.1000000000001.value (
<script>
   $(document).ready(function() {    // jquery onload alternative
	$('a#slick-show').click(function() {
		$('#slickbox').show('slow');
		return false;
  	});

   });
</script>
)


* the TEXT cobjects cache fine. you could even change the TS for the
include to load and cache the contents of the include file

------/----------

* I think pragmatically we tie in whatever javascript libraries we need
to jazz things up for each individual extension.

It is good to use shared base libraries
- to save on bandwidth
- common syntax
- upgrades and bug fixes are automatically available to your extensions

It also good to be able to rip a bit of js out of someones page and
whack it in your extension folder and hack to suit.

There is lots of easy to hack examples of eye candy out there. There are
good frameworks for write once solutions to client and server side
logic. The xajax extensions give us examples and support in working with
that approach.

Even for small amounts of additional javascript coding and even if not
in the style of the original JS script, I think it is worth using a
query/dom library. Saves so much JS grief. The base javascript query/dom
libraries I've tried are prototype and jquery.  I like jquery because of
the 'extension repository'. Lots and lots of examples.


More information about the TYPO3-team-extension-coordination mailing list