• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Conditional Statements

Explorer ,
Jun 17, 2016 Jun 17, 2016

Copy link to clipboard

Copied

Hi!

I would like to display different content in the sidebar of a 2 column page template.

I would like to create one template to use for a group of pages. Depending on the page name, I would like to display the pages specific content in the sidebar.

I figured I would need to use conditional statements but I don’t know how to go about writing this.

The different sidebar content would be placed in content holders.

Please help me in figuring this out.


Much appreciated.

Marian

TOPICS
Content management and modules

Views

442

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jun 17, 2016 Jun 17, 2016

Easy with liquid conditionals, but probably easier with just named pages and content holders. Here's one solution:

Create your sidebar contentholders with names like "Sidebar-About", "Sidebar-Home", etc.  The part after the "-" needs to be the page name where the content will appear.

In your template, insert this where the sidebar contents will go:

       {module_contentholder,name="Sidebar-{module_pagename}"}

Votes

Translate

Translate
Engaged ,
Jun 17, 2016 Jun 17, 2016

Copy link to clipboard

Copied

Easy with liquid conditionals, but probably easier with just named pages and content holders. Here's one solution:

Create your sidebar contentholders with names like "Sidebar-About", "Sidebar-Home", etc.  The part after the "-" needs to be the page name where the content will appear.

In your template, insert this where the sidebar contents will go:

       {module_contentholder,name="Sidebar-{module_pagename}"}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2016 Jun 17, 2016

Copy link to clipboard

Copied

Thank you!

Yes, easy enough. I thought I tried this once before but was not successful. I can assume then, I was doing something wrong.

Thanks again FriscoTX. You saved me a lot of time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 17, 2016 Jun 17, 2016

Copy link to clipboard

Copied

Does your plan have access to web apps? Can be similar but more powerful using that.

The actual page is the web app item, you can build a menu of the web app items, you can have a sidebar of content, feature image and more through the web app.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2016 Jun 17, 2016

Copy link to clipboard

Copied

LATEST

I would like to try this approach. I've been working with BC for over a year now and I would like to do so much more than the normal things.Yes, my plan has everything.

Learning BC the hard way I created many templates for pages that needed different types of content in the sidebars.

I would like to use only a few templates and advance more on using web apps as you suggested.

Thanks so much!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines