I think everyone would benefit if AOLserver includes some kind templating solution without installing whole OpenACS system. Strip down templating with several usefull tags like <if> <include> <multirow> <list> and etc would put AOLServer on the same level as PHP/Perl with Apache systems regarding templating. I can provide small version of my templating system which is kind of similar to OpenACS, it can work without any external dependencies. No documentation but good examples will be a good start.
Robert Seeger wrote:
Comments below:
Bas Scheffers wrote on 8/13/2004, 3:45 AM:
> IRA said: > > It's just this sort of problem that makes me wonder if the people > building aolserver ever actually USE aolserver to build web > > applications. It seems like not that big of a deal . . . until you > realize that we do this ALL THE TIME. > I could get as nasty and you and wonder why you are writing AOLserver > apps > when you don't actualy know Tcl.
People get grumpy when something is a continuous hassle to them. I'd rather work with the assumption that it was grumpy humour, rather than nastiness. :)
> > ns_puts "<a href=\"$link\">link</a>" > Can be written without the quotes simply by doing this: > ns_puts [subst {<a href="$link">link</a>}];# No escapes required!
True, but subst does still require an amount of escaping in various situations. For example:
# Lets output some financial data # We need to escape the $ for the monetary units
ns_puts [subst { <tr> <td><a ref="link[set $i]">Item $i</a></td> <td>\$$amount($i)</td> </tr> } # We need to escape the [ and ] for negative amounts ns_puts [subst { <tr> <td><a ref="link[set $i]">Item $i</a></td> <td>\$\[$amount($i)\]\$</td> </tr> } # {} need to be escaped too, if they come up
So, its not as simple as not needing to escape things. There's just less to escape.
> > Secondly: > > <% > if ($condition) { > %> > This html > <% > } else { > %> > This other html > <% > } > %> > > Makes for the most hideous, unreadable and unmaintainable code ever > concieved and should be avoided at all cost if you have any interest in > writing quality code.
For that type of output, yes its not the best choice. However, there are situations where doing it inside an ns_adp_puts is the more hideous of the choices. For example:
<table> <% foreach row $rows { foreach { item1 item2 item3 item4 item5 item6 item7 } $row {break} ### Output a lot of html for each row of data %>
<tr> <!-- 30 lines of html here that output the items -- and the form elements involved with them --> </tr>
%> ### Done with row } %> </table>
> > Tcl is called a "procedural language", best to use it that way and create > loads of nice little procedure to create html. Surely, > > set table_list [list 1 [link http://aol.com AOL]] > lappend table_list 2 [link http://genie.com Genie] > lappend table_list 3 [link http://msn.com MSN] > ns_puts [create_table -cols 2 -style linktable $table_list] > > is a lot more elegant and maintainable than writing all the tags > yourself? > (let alone using ASP style tags)
Very much so, at least for links. Do we actually have a nice, robust library of procedures that can produce complex html with a simple syntax? If so, thats great and I'd be happy to hear about it. If not, then every single person who uses the server to create pages making their own helper procs is just a source of server bloat.
Even with a good library, there are still some things that are better written in plain html. Its all about making the resulting page easily readable and maintainable, in my opinion.
Rob Seeger
-- AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
-- Vlad Seryakov 703 488-2173 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/
-- AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
