Jump to content


Web 2.0 / Javascript Integration


3 replies to this topic

#1 Luigi

    Etomite Forum Newbie

  • Member
  • 1 posts

Posted 19 January 2008 - 08:47 PM

My aims are to make a perfect integration with Web 2.0 and Javascript standards. The scripts I tend to use are based around 'Mootools', 'Scriptaculus' and 'Prototype' plus a few others.

I am sure that adding the script inclusion into the header code of the template would work but I am hoping to add them into a Chunk or Snippet, that way I can share and manipulate the codes.

So as I am very new to Etomite (Have created two basic sites but no real scripting) I am wondering if anyone has got this working or is sure if Javascript should be added externally (file linking) or hardcoded (Chunks or Snippets)?

Please let me know so I can start running some nice codes out to this forum.

Thanks in advance
Luigi Raw
www.flying-italian.com (To eventually be etomite)
www.westonmartialarts.org.uk (Etomite)

#2 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 19 January 2008 - 09:31 PM

You can include javaScript via all of the above, however, probably the easiest if as a chunk.
In your template you can call the file as an external file like this:

<script src="path_to_file/filename.js" type="text/javascript"></script>

or as a chunk like this:

<script src="{{chunk_name.js}}" type="text/javascript"></script>

Calling the javaScript into a document can be done as a chunk straight into the document where needed like this:

{{chunk_name.js}}

[EDIT] As an afterthought, the problem with using a chunk for existing scripts is that the relative paths change when called from a chunk. From a script, the relative path starts from the script itself, from a chunk, the script is being read from the etomite root (where your index.php file is). Often an existing file will need to have these paths checked to get them to work as a chunk, sometimes its easier to just do a template <script src> include.[/EDIT]

Edited by Cris D., 19 January 2008 - 09:37 PM.


#3 Randy

    Likes Etomite Forums!

  • Member
  • PipPip
  • 309 posts

Posted 19 January 2008 - 10:47 PM

Hi Luigi, ( my rant is at the top...your answer is below)

I understand fully what you would like to accomplish. Rather than have PHP render the UI, a javascript controlled and beautified UI that is modified through AJAXified (Web 2.0) controls would be a superior design architecture for today's fully capable web designer/developer.

The same type of discussions are going on elsewhere in regards to what makes the ideal architecture for the fully capable web programmer too. (i.e. the discussion about the efficacy of an LDAP implementation in the backend).

The unfortunate truth is that meeting the want's and rants of every human browser, user, publisher, designer, developer, coder, and hack is really, really, really hard.

You want Moo, someone else wants, Goo, and someone else wants Droo....all along while the lead developer of Eto likes YUI.

If you haven't looked at the JS currently inside Eto, it is one of the key areas of improvement the development team wanted to fix up. I would love to continue my work in a direction toward integrating a JS GUI interface that would allow easy Web 2.0 capabilities. But I wouldn't choose any of the ones you mentioned...ah, you see there is the dilemma.

--- your answer ---

For now, call your JS files from within your templates. Edit your JS files with your favorite JS IDE (Aptana). Keep good separation between your presentation and logic by only allowing your JS to control the presentation through JSON responses (unless you prefer to use XML) to AJAX requests from your JS calls for data needed to fill up presentation controls. Your templates, chunks, and snippets should have little or no HTML and CSS in them at all. It is likely you'll find yourself loading JS files from within snippets or chunks as I have needed to do this from time to time. This will help reduce the overall initial data transfer requirement (not send every file if not needed).

This should effectively work to provide you everything you need with the exception of Eto managing your JS code for you and allowing you to edit your JS through your Eto interface. That can be accomplished through the use of the file manager once you have it set up properly. Then you simply navigate to the directory with your JS files to edit them on line (if you really think you want to do this).

Hope you find this helpful.

#4 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 20 January 2008 - 04:33 PM

I have successfully used AJAX routines within Etomite, both as stand alone Javascripts and as a complete library - YIU as mentioned by Randy... Both methods work equally as well, edpending on intended purpose... But, as Randy pointed out, and we have had several long discussions on the subject, forcing a particular AJAX suite onto everyone can present problems... Heck, I really don't want to learn one AJAX suite, let alone several...

Now that I have that out of the way, a bit of background on how I have used AJAX within Etomite... I generally place my library calls in the head section of my page templates... Then, depending on the task at hand, I use a combination of snippets and chunks to achieve my goals... Looking back it's hard to believe that it has been well over a year since I did any serious playing with my YUI based Etomite install, which is currently broken... I used them to create tabbed panels, menus, XMLHttpRequest's, and more... The integration can definitely be done but it takes some time and effort to come up with versatile and reusable code...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users