Grrr.  I'm doing exactly those kinds of things.  Here's an example:

In adp_recall.tcl:

ns_register_adptag "dnr_remember" "/dnr_remember" dnr_adp_remember
proc dnr_adp_remember {input tagset} {
        global _dnr_adp_memory
        set tagname [ns_set iget $tagset name]
        if {[string length $tagname]} {
                set _dnr_adp_memory($tagname) $input
                return ""
        } else {
                return $input
        }
}
proc dnr_adp_recall {name} {
        global _dnr_adp_memory
        if [info exists _dnr_adp_memory($name)] {
                set parsecommand [list ns_adp_parse -string -local]
                lappend parsecommand $_dnr_adp_memory($name)
                ns_puts -nonewline [uplevel $parsecommand]
        } else {
                ns_log Error "[ns_adp_argv 0]: Unable to recall adp
fragment \"$name\""
        }
}

Then, I can do things like this, which is a conditional without an
include, and which is WYSIWYG-friendly:

                <dnr_remember name="login_failure">
                We were unable to complete your login. Please try again.
                </dnr_remember>
                <% if $login_failure { dnr_adp_recall login_failure } %>

Or this, which is repeated content:

                            <p>Nameservers:
                                <dnr_remember name="nameserver">
                                    <br>
                        &nbsp;<a href="host.adp?host=<%=[dnr_host
host_fqdn $ns]%>"><%=[dnr_host host_fqdn $ns]%></a>
                                </dnr_remember>
                                <dnr_remember name="address">
                                    <br>
                        &nbsp;&nbsp;<%=$address%>
                                </dnr_remember>
                                <%
    foreach ns [lsort -command dnr_host_compare_by_fqdn $ns_ids] {
        dnr_adp_recall nameserver
        foreach address [lsort $host_addrs($ns)] {
            dnr_adp_recall address
        }
    }
%>


On Mon, 20 Jan 2003, Patrick Spence wrote:

> Except the parser writing would happen once, whereas the HTML coding is an
> ongoing thing... :)

Not sure what your point was here.

> Dreamweaver has some really nice dynamic application
> extensions that make work like this to be fast and easy to work with.

Yes, my approach doesn't have dreamweaver extensions to support it (yet),
but...

> This doesn't really lend itself to prepare the variable and display it
> later...

I think this method lends itself to dynamic work just fine.  Try it before
you DOA it.

Pete.

Reply via email to