CMS Development

Philip_Marsh
Colaborador(a)

HubDB - Listing rows on a dynamic page (Child Table)

resolver

Hi,

apologises if this is a dumb question, but I'm very tired and have been working on a new FAQ section all day, and I think I'm burnt out. 

 

Set up: 

I have a Parent HudDB, that connects to Child DB's. My FAQ section has 3 dynamic pages:

  1. Page 1 - Main Page that lists different categories (Parent DB)
  2. Page 2 - A page that lists the Frequently asked Questions (Child DB)
  3. Page 3 - A page that has the Answer to the Questions.  (Child DB)

Problem:

What I want to achieve is on Page 3, the Answers page. I want the page to include a list of Questions from the Child DB. I can get this list working on Page 2 using the following code, but for some reason, this code doesn't want to work on Page 3. Any advice on how to do this?

{% set queryparam = "&orderBy=order" %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_row.hs_child_table_id) %}
{% for row in rows %}

<div>
<div class="faq-btn" data="img{{loop.index}}">
<p><span><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.question }}</a></span>
<img class="plus" src="https://cdn2.hubspot.net/hubfs/4351639/2019/assets-may-2019/plus-bold.svg" alt="plus symbol">
</p>
</div>
</div>

{% endfor %}

The example page is below:

0 Avaliação positiva
1 Solução aceita
Philip_Marsh
Solução
Colaborador(a)

HubDB - Listing rows on a dynamic page (Child Table)

resolver

I figure it out, I had to use

 

 

dynamic_page_hubdb_table_id

 

Instead of 

 

dynamic_page_hubdb_row.hs_child_table_id

 

Full code:

{% set queryparam = "&orderBy=order" %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
{% for row in rows %}

<div>
<div class="faq-btn" data="img{{loop.index}}">
<p><span><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.question }}</a></span>
<img class="plus" src="https://cdn2.hubspot.net/hubfs/4351639/2019/assets-may-2019/plus-bold.svg" alt="plus symbol">
</p>
</div>
</div>

{% endfor %}

Exibir solução no post original

8 Respostas 8
SJaeger
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

HubDB - Listing rows on a dynamic page (Child Table)

resolver

hi,

 

is this value filled on page2/3 

 

dynamic_page_hubdb_row.hs_child_table_id

 

because i think on page 2 u dont have connect to parent first table request

Nothing is impossible
0 Avaliação positiva
Philip_Marsh
Colaborador(a)

HubDB - Listing rows on a dynamic page (Child Table)

resolver

On page 2, it's

{% set rows = hubdb_table_rows(dynamic_page_hubdb_row.hs_child_table_id) %}

And that works, and I'm using the same code on Page 3, as it is, and it no longer works. I assume because when I'm on page 3, it can only check what's in a single row, rather than the entire DB? 

The child database has 2 columns:

  • Question
  • Answer

Page 3 I have displaying a single Question, with the corresponding answer. What I also need is a list of the other Questions in that child database. 

0 Avaliação positiva
SJaeger
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

HubDB - Listing rows on a dynamic page (Child Table)

resolver

Hello,

I rather think that he loses his reference to "page2" iwo do you pass parameters in the url? would it be easier to work with url parameters so that you are permanently saved and can also share the links?

Nothing is impossible
0 Avaliação positiva
Philip_Marsh
Solução
Colaborador(a)

HubDB - Listing rows on a dynamic page (Child Table)

resolver

I figure it out, I had to use

 

 

dynamic_page_hubdb_table_id

 

Instead of 

 

dynamic_page_hubdb_row.hs_child_table_id

 

Full code:

{% set queryparam = "&orderBy=order" %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
{% for row in rows %}

<div>
<div class="faq-btn" data="img{{loop.index}}">
<p><span><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.question }}</a></span>
<img class="plus" src="https://cdn2.hubspot.net/hubfs/4351639/2019/assets-may-2019/plus-bold.svg" alt="plus symbol">
</p>
</div>
</div>

{% endfor %}
SJaeger
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

HubDB - Listing rows on a dynamic page (Child Table)

resolver
  1. then mark als answered 😉 so every one see your solution
Nothing is impossible
Philip_Marsh
Colaborador(a)

HubDB - Listing rows on a dynamic page (Child Table)

resolver

Done. I also edited it to include the full example

0 Avaliação positiva
himanshurauthan
Autoridade no assunto | Parceiro Elite
Autoridade no assunto | Parceiro Elite

HubDB - Listing rows on a dynamic page (Child Table)

resolver

Hello @Philip_Marsh,

 

Please check your page-2 and page-3 specifications, both should be the same.

If they are same then please let me know what error you are getting on implementing the code for page-3.

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Avaliação positiva
Philip_Marsh
Colaborador(a)

HubDB - Listing rows on a dynamic page (Child Table)

resolver

Hi, sorry, what do you mean by 


@himanshurauthan wrote:

Hello @Philip_Marsh,

 

Please check your page-2 and page-3 specifications, both should be the same.


Thanks,

0 Avaliação positiva