Xavier,

Here is a link to the templating system, right now it is part of a larger 
toolkit:

http://junom.com/twt/tic-tac-toe/

The README explains the basics, plus explains what files to look at for 
examples. Basically:
.tcl files -- click and see the result of running the tcl file and then 
sourcing the compiled template.
.tmpl files -- source of template, click and you see the template prior to 
compiling.
.tcl~ -- 'emacs backup' file, actually just a copy of the tcl file with an 
extension that AOLserver treats as text/plain.
.cmp -- source of compiled template. Compiled templates are simply tcl 
scripts.

In answer to the variable question:

Your confusion is thinking that there is something special about .adp 'pages'. 
These are turned into a Tcl script, more or less, or maybe better to think of 
them as turned into 'code'. But what is happening is the same as a .tcl file: 
the script is like a toplevel script, so you have a local scope that is not 
inside a procedure, and when the initial ADP is sourced, there are only 
global variables in existence, like a clean slate, just like you started up a 
tcl shell (but you do have globals already there). So if you start up a tcl 
shell and do this:

% puts $a 
can't read "a": no such variable

So there is no difference. 

If you have an question about what variables exist within a scope, use the Tcl 
[info] command:

<% ns_adp_puts [info locals] %>
<% ns_adp_puts [info vars] %>

There is nothing wrong with the ADP templating system, the good things are 
that it is familiar to those who use ASP, it is probably friendly to 
development tools which understand ADP syntax, etc. But there is also 
something called registered tags:

http://rmadilo.com/files/nsapi/ns_register_adptag.html
http://rmadilo.com/files/nsapi/ns_adp_registertag.html

In the newest version of the ADP templating system, these apparently work well 
together, but I'm not the expert. 

tom jackson

On Sunday 20 April 2008 02:48, Xavier Bourguignon wrote:
> So Bob, what is the difference between setting the variable within the
> adp and setting it in a procedure? Surely the variable set in the
> procedure should be available as the procedure is called within the
> adp.
>
>
> Tom, what templating system do you use? How do you use it? any links
> for a noob like me to learn?
>
> thank you
>
> On 20/04/2008, Robert Seeger <[EMAIL PROTECTED]> wrote:
> >  It might help to consider each adp page (or include'd page) as a tcl
> > proc. As such, if you define the variable on the page, it will be visible
> > there:
> >
> >
> > <html>
> >    <head></head>
> >    <%
> >    set bob 1
> >    %>
> >    <body>
> >      <!-- the following will both work -->
> >      <%= $bob %>
> >      <% ns_adp_puts $bob %>
> >    </body>
> >  </html>
> >
> >  However, things defined in other pages/includes or other procs would
> > need to be global to be accessed.
> >
> >  Rob Seeger
> >
> >
> >  Xavier Bourguignon wrote:
> >  <html>
> >  <head>
> >  </head>
> >  <body>
> >  <%proc_call%>
> >  <h1><%ns_adp_puts $varname%></h1>
> >  </body>
> > </html>
> >
> > Unless varname is global in proc_call, then it seems that varname is
> > unknown to the tcl interpreter.
> >
> > How do you get away with not using adps? They are the building blocks
> > of dynamic pages aren't they?
> >
> > Thanks
> >
> > On 19/04/2008, Tom Jackson <[EMAIL PROTECTED]> wrote:
> >
> >  On Saturday 19 April 2008 12:52, Xavier Bourguignon wrote:
> >  > Hi,
> >  >
> >  > In one of my adp files I want to display the value of a tcl variable,
> >  > so I do this <%=$varname%>
> >  >
> >  > My problem is that I can only see the value when my varname is set to
> >  > global in my tcl script?
> >  >
> >  > My question is: Why does the variable have to be a global? can't I do
> >  > set varname varvalue and then use in my adp?
> >  >
> >  > Thank you
> >
> > Can you give a complete and simple example of what _doesn't_ work?
> >
> >  I don't use adps very often, but I never noticed a problem with using
> > local variables.
> >
> >  tom jackson
> >
> >
> >
> >  --
> >  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.
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > 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.


--
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.

Reply via email to