CMS Development

ghislaineguerin
参加者

Pass page name as query parameter

On the attached, I'm trying to replace "restaurants" with {{ content.name }}

so that the generated pages change the content dynamically. How would I go about doing that?

 

{% set queryparams = "" %}
{% set queryparams = queryparams ~ "&hs_name=Restaurants" %}

{% set table = hubdb_table_rows(dynamic_page_hubdb_table_id, queryparams) %}

0 いいね!
4件の返信
Jsum
キーアドバイザー

Pass page name as query parameter

@ghislaineguerin,

 

This the variable for content name: {{ content.name }}

 

so you could concatinate this to the end of your string. I'm pretty sure it will ouput with spaces so you might need to filter to format the name, replacing spaces with dashes or however your urls are set up for the pages. 

 

{% set urlend = content.name|whateverfilter() %}

then concatenate "urlend" to the end of your string (outside the quotations). 

 

There might be other variables you can use that reference the url itself as well. check out http://designers.hubspot.com/docs/hubl/hubl-supported-variables

0 いいね!
mwhite
参加者

Pass page name as query parameter

I'm trying to do the same basically:

 {% set ticketGroup = "{{ dynamic_page_hubdb_row.image1 }}" %}

 

<!--How do I replace 6172F below with the variable {{ ticketGroup}} ?-->

 

{% set queryparams = "" %}
{% set queryparams = queryparams ~ "&image1__contains=6172F" %}

 

Any help is greatly appreciated!

0 いいね!
mwhite
参加者

Pass page name as query parameter

I got it!

 

{% set queryparams = "" %}
{% if request.query_dict.formnew %}
{% set queryparams = queryparams ~ "&image1__contains="~request.query_dict.formnew|title|urlencode %}
{% endif %}

{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id, queryparams) %}
<li> {{ row.image1 }} is {{ row.formnew }}</li>

0 いいね!
ghislaineguerin
参加者

Pass page name as query parameter

Thank you, I'm going to give this a try and let you know.

0 いいね!