> i´ve started a project on sourceforge. It´s called Ajax Pages, it´s
> a scripting template engine that enables rapid development of Ajax
> Web-based Applications. I would like you guys to take a look and give
> me some feedback on it .
I don't really understand the value that it adds. But aside from that, I
have two comments after scanning the code for 2 seconds:
1) You use eval. Don't.
2) This code below seems highly fragile. Why is one branch async and the
other not? You're not handling onreadystatechange or anything for async
requests, which means this code will most certainly break. Your underlying
Ajax communication layer definitely needs to be more robust.
AjaxPages.prototype.load = function ( url ) {
var req;
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.open("GET", url, false);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.open("GET", url, true);
req.send();
}
}
this.template = req.responseText;
return req.responseText;
}

Signature
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Gustavo Amigo - 28 Jul 2005 17:51 GMT
First of all, thanks for the reply.
I totally agree with you about the robustness underlying communication.
I´ve been working on this code for a week and there are many points of
improvement. The first thing i want to do is make everything
assyncronous. I don´t understand what is the problem of eval, can you
clear that point for me?
About the value that it adds, it´s just a personal thought. But i come
from the Java world where the MVC pattern is used everywhere.
Implementing the MVC pattern with Javascript seemed to me
non-productive because it´s hard to work in a productive way
manipulating DOM dircectly. A client-side template language can make
the View Component of a MVC implementation very productive. For
example, i added a blog example to the project. It was implemented in a
matter of hours.
Gustavo Amigo
> Hi,
>
[quoted text clipped - 9 lines]
> []´s
> Gustavo Amigo
Your blog demo page source starts:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Ajax super blog</title>
<link href="style.css" type="text/css" rel="stylesheet">
<script language="javascript" src="../../src/AjaxPages.js"></script>
<script language="javascript">
<!--
...
The language attribute is depreciated, type is required.
Putting "comment" tags ( <!-- --> ) inside a script element in an XHTML
page may cause the user agent to delete or ignore everything between the
tags - which is why such usage is discouraged always.
Either put all scripts in external files or use:
<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>
<URL:http://www.w3.org/TR/xhtml1/#h-4.8>

Signature
Zif
The Magpie - 31 Jul 2005 17:55 GMT
>> i´ve started a project on sourceforge. It´s called Ajax Pages, it´s
>> a scripting template engine that enables rapid development of Ajax
[quoted text clipped - 3 lines]
>>
>> http://ajax-pages.sourceforge.net/index.html
[snip]
> Putting "comment" tags ( <!-- --> ) inside a script element in an XHTML
> page may cause the user agent to delete or ignore everything between the
> tags - which is why such usage is discouraged always.
Rather than simple Ajax, you might want to take a look at OpenLaszlo,
which fits perfectly into the Ajax format and is based on a compiled
(yes, compiled) set of Flash tool widgets that can be delivered to web
pages direct. You can find details at http://www.openlaszlo.com/