New to board, simple HubDB call help needed

Hi,

I’m building out a careers portal for our corp site - on department pages I’ve based my efforts on the dynamic page code tutorial below, which I’m trying to get to pull only rows with a specific entry in location multiselect column (UK in this case), unffortunately I can’t seem to get it to work?

<!-- Individual page content goes here -->

{% if dynamic_page_hubdb_row %}
<h1 style="text-align:center;">{{ dynamic_page_hubdb_row.hs_name }}</h1>
<p class="section-intro">Job Title: {{ dynamic_page_hubdb_row.listing_title }}</p>
<p>Based: {{ dynamic_page_hubdb_row.listing_location }}</p>

<!-- Listing content goes here -->

{% elif dynamic_page_hubdb_table_id %}
{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id,"&location__contains=UK") %}
<h5><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}</a></h5>
<p>{{ row.listing_excerpt }}</p>
{% endfor %} 
{% endif %}

Also, is it possible to have the top part, which generates the dynamic drill down page, load a different template?

Any pointers happily received!

Ewan

HI @Ewan,

have you tried to change

&location__contains=UK

to

&location=UK

?

Because currently the template tries to check if the row “locaction__contains” have a input/options named by “UK”.

For the “top part”:
Do you want to give it a different layout or load it on another page?(which wouldn’t make much sense imo)

regards,

Anton

Hi Anton,

Awesome - the ‘contains’ bit, I assumed wrongly was necessary for multipicker, so thanks for that.

re top part - the listing part is at the foot of a templated overview page, so I don’t want to pull through remainder of page when a client clicks through to drill down detail page on listing - so I was thinking to load a second template just for drill down pages?

E

glad to hear that it worked :slightly_smiling_face:

To be clear:

You want some kind of “listing” and “detail” page in one module? Is that correct?

If this is what you want, you’ll propably need some kind of “trigger” that will recognize if it’s the “listing” or “detail” page

Hi there, yes, I have the full listing as a page elsewhere, dynamically spinning pages off as rows are added to db. So ideally a module I could insert anywhere on site that would spin out the simple detail pages from a job list.

I’d like to learn about using a using trigger - would I be heading in correct direction with:

{% if topic %} {{ content.template_path|replace('/template2 | ', '') }}

or is that way off?

E

hmm,

I’m not quite sure about this.

Why do use

{% if topic %}

?

As far as I know it’s “reserved” to blog code snippets.

What you could try is something like this(maybe a little bit overkill)

Write the layout for the “listing” page and link the card/button(or whatever you want to use as a clickable function to enter the detail page) to a dynamic link like www.YOURDOMAIN.com/team/member-name

The “member-name” is equal to the name column in your hudb.

write below the listing layout a for-loop how you want the detail page to look.

The code below is a very simple layout(without logo, navigation, footer …) which will need some css styling.

<div class="row header">
<div class="container">
<div class="span12">
<div class="team-member-name"><h1>Teammember Column row name</div>
</div>
</div>
</div>
<div class="row team-member-body">
<div class="container">
<div class="span2 team-member-pic"><img src=""></div>
<div class="span7 team-member-bio"><p>Insert the bio column here</p></div>
<div class="span3 team-member-contact">Insert the contact information column from the member here</div>
</div>
</div>
</div>

You could also try to design a layout in the design manager(with all the classes), export it as a “HTML Template” and insert the whole code inside the for-loop. After that you paste the hubdb elements in the desired places and save it.

Since I’ve never tried this, it’s only “theory”.

Maybe @Stephanie-OG, @Yoshi know how this could be done or somebody who know it :slightly_smiling_face:

regards,

Anton

Hi Anton,

Many thanks for the pointers!

All sorted out.

Ewan