Forum OpenACS Q&A: Re: List builder, db_multirow -extend and <include>

Collapse
Posted by Jade Rubick on
Have you looked at my list-builder docs?

http://www.rubick.com/openacs

You can use the <group> tag

Jade, I have been using your list-builder and your (and Jon Griffin's) ad_form docs to get as far as I've gotten. Thanks for all that work!

In this case, I'm trying to get around using <group>, basically because it messes up the alternating row colors. Not a very big reason, but now the bee's in my bonnet. I've gotten this far:

template::list::create \
    -name shares \
    -multirow shares \
    -key share_id \
    -elements {
        share_id {
            label "ID #"
            link_url_col item_url
            link_html "View"
        }
    ....
        test {
            label "Test"
            display_template {
                @shares.test;noquote@
            }
        }
    } \
    -main_class { narrow }

db_multirow -extend { item_url test } shares get_shares {
} {
    set item_url [export_vars -base "one-share" {share_id}]
    set test "<include src=\"share-member-list\" share_id=\"$share_id\">"
}

So with db_multirow -extend, you add on a value that contains the HTML for the <include> and use disply_template to output it (with noquote). Done this way, the output is what you expect, but the <include> doesn't get processed (you can see the tag if you view the source). That would seem to imply that because of the order in which things are processed, there is no simple way to stick an <include> into template::list::create.

So what I probably have to do is store the HTML I would have wanted from the <include> in a variable within db_multirow. Ie.:

db_multirow -extend { item_url test } shares get_shares {
} {
    set item_url [export_vars -base "one-share" {share_id}]
    set test [make_me_a_list $share_id]
}

Where make_me_a_list would return the HTML for my desired <ul>.