Forum OpenACS Q&A: Question on listbuilder

Request notifications

Posted by Nick Kokkos on
Hi all.
I am trying to get the listbuilder work in order to display
some photos. It is basic but probably I am missing the point
here. I searched the forums but could not get the help I need.
Basically, I upload some photos through ad_form and I save
the thumbnails and original pictures in say mypackage/www/images/. What I want to do is to be able to see
a thumbnail of the every picture using the listbuilder.
I followed the examples in the docs and this the code of the listbuider:

template::list::create -name recipes-list \
-multirow photos \
-key item_id \
-actions {"Add a photo" add_photo } \
-bulk_actions { "Remove checked photos" "photo-delete" "Remove checked photos" } \
-elements { \
item_id { label "Photo_ID" } \
title { label "Title" display_col title } \
filepath { label "FilePath" display_col filepath2 } \
recipe_description { label "Description" display_col recipe_description } \
delete {
link_url_col delete_url
display_template {

sub_class narrow

edit {
link_url_col edit_url
display_template {

sub_class narrow
view {
link_url_col view_url
display_template {

sub_class narrow


db_multirow \
-extend {
} photos select_photos {
select id as item_id, title, filepath,
photo_description from photos
} {
set delete_url [export_vars -base "photo-delete" { item_id } ]
set edit_url [export_vars -base "add_photo" { item_id } ]
set view_url [export_vars -base "view" {item_id } ]

Obviously, the filepath points to the picture thumbnail.
How do I get it to display the thumbnails in a list?
The code display_template {....} works only for static gifs.
Thank you so much in advance..

Posted by Claudio Pasolini on
You can put within display_template also any column defined in the multirow using the standard adp syntax, i.e.:

display_template {
<img src="@photos.filepath;noquote;@" width="16" border="0">
Posted by Brian Fenton on
Hi Nick,
I don't think your posting is displaying correctly - I can see little images in the display_template sections. :-) Try again and we'll see if we can help you.


Posted by Nick Kokkos on
The listbuilder code is almost the same as the one in the development tutorial(my first package). Unfortunately, when I insert the code in the posting, the code gets parsed by forums and you get to see the image, not the code. Strange.

Say an element of the list contains the path to the file we want to show and I just wanted to show the thumbnail of every file in the list. That was my problem.

Now it works thanks to Claudio's solution.
List builder is so cool but complicated and since I'm learning this stuff now, I get confused.
Thanks for all the help to everyone by the way.