I have created the database in HubDB and have published it and referenced the table ID in the code created in the custom module. When I copy the code into the custom module there is a lot of code warnings.
I would also like to filter by a couple of the columns so that I can see how that works but at the minute I can't get the table to pull through into the custom module.
How the two versions of the design manager affect HubDB? I am current ly in the old design manager as this tutorial was written a while ago. Does the above tutorial not work in the current / new design manager?
I would be really grateful if there is someone in this forum who has implemented a searchable / filterable resource listing that could share the basic code and same HubDB table.
On line one of your statement, youdon'tt need the curly braces around your table id. So it should read
{% set table = hubddb_table_rows(848816, queryparam) %}
Likewise, it looks like you currently don't have any query params set. I would add above this line:
{% queryparam = "" %}
This way the statement would know that the current queryparam is empty.
For all the other items in your {% for %} loop, you would want to use the following syntax to show the information in the columns.
{{ row["name_of_hubdb_column"] }}
Essentially, the name of your column should be there. You can find that name by going into the dropdown on the column and choose edit column. You'll then see the readable name you choose for the column as well as the reference name (usually with underscores) for the column.
I hope this helps. If you have any additional questions, please let me know.
I have a order column (numbers) in my hubdb numbered 1,2,3,4,5 etc... How would I use this to order the resources? So if I change the order numbers in my hubdb to 2,5,3,1,4 the listing would reorder to always pull 1,2,3,4,5.
Jul 26, 201810:13 AM - edited Jul 26, 201810:30 AM
Top Contributor
Resource Listing
Hi there I'm having trouble implementing the code to get the multi select column of the hubdb to show all the selected items per row. The multi select column is named tags.
My code is:
{% set table = hubdb_table_rows(848813, "&orderBy=resource-order") %}
{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}
{% for row in table %}
<a href="{{ row["listing_url"] }}">
<div id="resource-listing" >
<div class="{{ row["type"].name }}">
<div class=resource-thumbnail><img src="{{ row["thumbnail"].url}}"></div>
<div class="resource-details">
<h2>{{ row["resource"] }}</h2>
<p><b>Focus area:</b> {{ row["focus"].name }}</p>
<p>{{ row["description"]}}</p>
<div class="button"><a href="{{ row["listing_url"] }}">Details</a></div>
</div>
</div>
</div>
</a>
{% endfor %}
{% endif %}
Hi, I tried adding the code which worked. I wanted to add a background color behind each tag with margin right to separate them so that they appear in blocks.
I ended up with a row of tags with the background running across all of them with no spacing between each and there was extra blocks of background color at the end of the last tag. Looking at the outputted code all the <spans> are nested within each other.
This worked perfectly but for some reason the first tag is in a unordered list and the others that follow are not within the <ul> but are just in <li> after
The html that I pulled from the compiled webpage is:
If I want to display 10 items per page with paging and next and previous arrows is there an example that you could share with me that would help me implement this fuctionality?
Sorry for the delay. Here is a sample of code that was shared on the HubSpot developer slack channel from Stefen Phelps (@stefenp😞
<!-- Pagination Logic -->
{% set per_page = 36 %}
{% set page_number = 1 %}
{% set total_pages = (table_rows|count / per_page)|round(0, 'ceil')|int %}
{% set offset_posts = request.query_dict.page * per_page %}
{% set queryparam = "&limit=" ~ per_page ~ "&offset=" ~ offset_posts|urlencode %}
{% set table = hubdb_table_rows(XXXXXX, queryparam) %}
<!-- Previous / Next Links -->
{% if request.query_dict.page %}
{% set page_number = request.query_dict.page|int %}
{% endif %}
{% if page_number > 1 %}
<a href="{{ request.path }}?page={{ page_number - 1 }}">Previous</a>
{% endif %}
{% if page_number < total_pages %}
<a href="{{ request.path }}?page={{ page_number + 1 }}">Next</a>
{% endif %}
This is what I've used as a starter when doing pagination. If you are not apart of the developer slack channel, I highly suggest you join it. There are many of us on there who help with many issues that users run into. You can signup for the slack channel here: