A way to dynamically hide dnd_sections on certain Dynamic pages
SOLVE
Hi there,
I'm currently facing this issue where I'm unable to hide certain dnd_sections based on whether I'm on overview page or detail page when rendering dynamic pages via HubDB.
So for example on one page where you can see all the clickable links to go to essentially a HubDB row page when clicked, I need to hide certain sections because those are only displayed on the detail page for that certain HubDB row and it's data. Is there an easy way to do this? CSS display:none doesn't work I believe because you wrap a dnd_section in a div with a class, at least I didn't get that to work.
Any help would be much appreciated! I'm kinda lost, and have tried a lot.
- add a boolean(checkbox) like "Show section X" as a column to your table and wrap the corresponding section in an if statement like
{% set table_info = hubdb_table_rows( "Your-HubDB-ID" ) %}
{% for row in table_info %}
{% if row.show_section_x %}
...
Your layout
...
{% endif %}
{% endfor %}
- you could "automate it" by showing your layout based on an input from a different column. So if you'd like to show a specific section if the content(text) of a different column is "Cars" you could do it like this
{% set table_info = hubdb_table_rows( "Your-HubDB-ID" ) %}
{% for row in table_info %}
{% if row.headline == "Cars" %}
...
Your layout if the headline is cars
...
{% elif row.headline == "Bikes" %}
...
Your layout if the headline is bikes
...
{% elif row.headline == "" %}
...
Your layout if the headline is empty
...
{% else %}
...
Fallback for everything else
...
{% endif %}
{% endfor %}
best,
Anton
p.s: Those techniques require a custom pagetemplate with all of your HubDB settings/layout/functions and the parent & child page layouts.
A way to dynamically hide dnd_sections on certain Dynamic pages
SOLVE
But the problem with that is we can't have logic inside a dnd_area. So to show a section we would have to put that if in a dnd_area which doesn't work. And we can't have multiple sections based on an if, as that also didn't give results.
A way to dynamically hide dnd_sections on certain Dynamic pages
SOLVE
I understand, but that dnd_area is in a dnd_section. So we can't have logic in there either. And you can't have 2 dnd_sections, at least not from what I've seen.