Output Gallery From HubDB Column Values

Highlighted
Regular Contributor

I'm trying to make a slider output for each row of a HubDB. So I have colums labeled Image1, Image2, Image3, etc.

 

I want to be able to say "If "Image1(column)" contains an image, then add it to the gallery." Then the same for all image columns.

 

I tried this:

 

 

{% set table = hubdb_table_rows(#######, queryparam) %}
{% for row in table %}

<div class="prod-slider">

{% widget_block gallery "Gallery" display_mode='standard' sizing='static', transition='slide', caption_position='below', auto_advance=True, overrideable=True, description_text='', show_pagination=True, label='Gallery', loop_slides=True, num_seconds=5 %}
{% widget_attribute "slides" is_json=True %}[
{"caption": "blah", "show_caption": true, "link_url": "/", "alt_text": "blah", "img_src": "{{ row.image1.url }}", "open_in_new_tab": false}, 
{"caption": "blah", "show_caption": true, "link_url": "/", "alt_text": "blah", "img_src": "{{ row.image2.url }}", "open_in_new_tab": false},
{"caption": "blah", "show_caption": true, "link_url": "/", "alt_text": "blah", "img_src": "{{ row.image3.url }}", "open_in_new_tab": false}
]{% end_widget_attribute %}
{% end_widget_block %}

</div>

{% endfor %}
{% endif %}

 

 

The slider is generating, however the "img_src": is not working, it's simply outputting {20% row.image3.url20%} as the image url.

 

How can I correctly reference the URL of a colum's image within this context?

(I've tried removing "{{ }}", etc.)

and

How can I ask "If Column1 contains a value..., add the line of code as a slide"

 

Also, if there is an easier way to accomplish this, I'm all ears!

Reply
0 Upvotes
1 Reply
Regular Contributor

Any ideas on how to best implement a multi-image gallery on a HubDB dynamically generated page?

Reply
0 Upvotes