Forum OpenACS Development: How to generate the list-builder name dynamically

Hi, I'm trying to generate more than one list-builder in the same page and I'm trying to generate the name dynamically, doing something like this:

db_multirow name sql_name { 
select dynamic_name as list_name
} {
...

    template::list::create \ 
        -name $list_name \ 
        -multirow $list_name \ 
         ...
}

and in the adp file I'm trying to do this:

 <multiple name="name">
 <listtemplate name="@name.list_name@"></listtemplate> 
 </multiple>

but I get an error(

missing close-brace
    while compiling
"uplevel"
    (compiling body of proc "template::code::adp::/var/lib/aolserver/service0/p...", line 2)

)

When I remove the @s from the adp file and do it like this


    template::list::create \ 
        -name no_dynamically \ 
        -multirow no_dynamically \ 
         ...

and in the adp:

 <multiple name="name">
 <listtemplate name="no_dynamically"></listtemplate> 
 </multiple>

It works fine, but since I am generating the lists inside a multirow, the only list that I see in the final html page is the one with the last values obtained by the multirow

Can anybody help me? Is there another way to do this?

Thanks!
Collapse
Posted by Jade Rubick on
I think this might not work because you'd need another round of having the variables interpreted. I'm not sure that you'll be able to do this, but I also don't have any knowledge of the inner workings of the system.

You can create more than one list-builder on a page, but you may have to predefine the names.

Collapse
Posted by Lars Pind on
Hi Jose

I changed the implementation of the listtemplate and related tags, so you can now use a template variable instead of a hard-coded value.

This change is on oacs-5-1 branch, revision # 1.18.2.3, but you should be able to back-port this without problems.

See

http://cvs.openacs.org/cvs/openacs-4/packages/acs-templating/tcl/list-procs.tcl?r1=1.18.2.2&r2=1.18.2.3

/Lars