CMS Development

CWoods
Member

Dynamic page & conditional section

  • I have a Hubdb table that contains a list of partners.
  • This table is linked to a dynamic page
  • I have a section on the page that I would like to show to some partners... but not show to others

Is there a way that I can conditionally show a section on a dynamic page based on a flag set in the current Hubdb record?

0 Upvotes
4 Replies 4
CWoods
Member

Dynamic page & conditional section

I'll make this a bit more generic:  Is it possible to make a section or a module on a page conditional? Example: Only show this section if there is a specific parameter in the query string?

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Dynamic page & conditional section

hey @CWoods 

Apologies for delayed response! 

At a high level, what I think you are lookin for is an if statement

and possibly using an HTTP request variable for your test. 

@stefen , any thoughts?

 

0 Upvotes
CWoods
Member

Dynamic page & conditional section

I've written a lot of Hubl. I'm not asking how... I'm asking where... and if it is even possible?

Here's an example:

  • The image below is a section on a Hubdb dynamic page that has a module in it.
  • On some of the dynamic pages I don't want this section (or the module inside of it) to be shown.
  • I know how to write conditional logic, do lookups on the hubdb table to check which record I'm dealing with, etc.  That isn't a problem.
  • What I'm trying to understand is *WHERE* to actually write the code that would do the checks and then determine whether a section and/or module should be shown?

    Screen Shot 2022-02-25 at 10.07.20 AM.png
0 Upvotes
stefen
Key Advisor | Partner
Key Advisor | Partner

Dynamic page & conditional section

@CWoods to show or hide the module you would write the HubL code in the module. If you want to hide the entire section then you would want to wrap that section/drag and drop area with the logic so that would go in the template file.

Stefen Phelps, Community Champion, Kelp Web Developer