CMS Development

CephasO
Membre

HubdB Column Data Can't Be Retrieved in a Gallery Slide Block Syntax

Résolue

Hi guys,

Kindly help out with this.
I’m trying to retrieve rows data from a hubdb table like this:

 

 

 

{% set gallery = hubdb_table_rows(<tableId>, "<columnName>__contains=<a multi-select columnProperty>") %}
{% if gallery == [] %}
<p class="error__notice"> Sorry, you do not have objects in your database. Try changing the filter </p>
{% else %}
<div class="digi__gallery-items">
{% for row in gallery %}
{% module_block gallery "Gallery" display_mode="standard" sizing="static", transition="slide", caption_position="superimpose", auto_advance=True, overrideable=True, description_text="", show_pagination=True, label="Gallery", loop_slides=True, num_seconds=5 %}
{% module_attribute "slides" is_json=True %}
{
"caption": "<h3>{{ row.authors }}</h3>",
"show_caption": true,
"link_url": "{{ row.main_url }}",
"alt_text": "Screenshot of eP",
"img_src": "{{ row.image.url }}",
"open_in_new_tab": true
}
{% end_module_attribute %}
{% end_module_block %}
{% endfor %}
</div>
{%.endif %}

 

 

 



I’m using the hubl gallery tag (as per the block syntax method with a slide parameter attribute) to loop over an image and link columns as shown in the code block with expectation {{.row.image.url }} returns an image link, while {{ row.image_url }} provide the hyperlink for each slide.

Unfortunately, the aforementioned table data don’t work but, the caption property (Json) successfully pulls up data from the database as shown in the screenshot below.
Screen Shot 2022-06-11 at 07.47.19.png

 

What am I doing wrong and could you suggest an easier work-through? THANKS!

0 Votes
1 Solution acceptée
Indra
Solution
Guide | Partenaire solutions Elite
Guide | Partenaire solutions Elite

HubdB Column Data Can't Be Retrieved in a Gallery Slide Block Syntax

Résolue

Hi @CephasO,

 

You should check your code.

For example. In your code at the end you are closing your endif like {%.endif %} (with a dot in between)

This won't work.

 

Also, the object you want to display starts with { (curly brackets) but the documentation is telling to start with [ (brackets).

 

I suggest to check the documentation for gallery.


Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution

Voir la solution dans l'envoi d'origine

0 Votes
2 Réponses
Indra
Solution
Guide | Partenaire solutions Elite
Guide | Partenaire solutions Elite

HubdB Column Data Can't Be Retrieved in a Gallery Slide Block Syntax

Résolue

Hi @CephasO,

 

You should check your code.

For example. In your code at the end you are closing your endif like {%.endif %} (with a dot in between)

This won't work.

 

Also, the object you want to display starts with { (curly brackets) but the documentation is telling to start with [ (brackets).

 

I suggest to check the documentation for gallery.


Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
0 Votes
CephasO
Membre

HubdB Column Data Can't Be Retrieved in a Gallery Slide Block Syntax

Résolue

Thanks Indra,

I wasn't aware of the dot in-between my endif.
Well, I succeeded in showing the image by decoding encoded URL strings back to the original URL like this

{{ row.image.url|urldecode }}

 I will check the documentation to understand the object syntax you mentioned later. 

Anyways, THANKS for spotting the bugs in my code.