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

Choosing which web app items appear on which pages

Guest
May 22, 2015 May 22, 2015

Copy link to clipboard

Copied

Hello,

I'm looking for a scalable way to add testimonials to the sidebars of pages (this also applies to page banners).

In the past, we would use classifications and have different code in each sidebar to render the testimonials with the classification.  However, this is cumbersome because we need different code in each sidebar, and there are a number of steps either we or the client need to do if they are creating a new page (creating the new classification, updating the sidebar code in the page template for the new page). 

Does anyone know of a better way to do this?  With Liquid for example, the client could enter the page name or URL in a field, and the code could detect if that page is present when looping through the items.  I can do that, but I'm still wondering if there is a more elegant solution.  My main concern with this method is that it is still subject to client error when copying/pasting the information into the web app item.

Does anyone have a better way of doing this?  It really doesn't make sense to have a different page template for every page if they have a different banner/sidebar. 

It would be great if there was a data field in a web app item that could populate the list of pages (and all web app detail pages) on the site so the item could be linked with that page in a consistent, predictable way.

Thanks for any ideas/support.

Jeff

TOPICS
Developer

Views

415

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

Enthusiast , May 24, 2015 May 24, 2015

I agree with Ira/Machinette,

You certainly do not need a template for each page or web app detail.

What you need to do is find a reference point or marker that will allow you to determine which testimonials need to be displayed on which page, using liquid.

Not knowing the intricacies of the product I can only offer a very broad solution / suggestion:

My suggestion is to name each Testimonial Item the same as the page you want the testimonial to appear. This creates a 1-1 relationship. 1 testimonial

...

Votes

Translate

Translate
Engaged ,
May 22, 2015 May 22, 2015

Copy link to clipboard

Copied

Hi Jeff,

There is no need to have a template for every page. Are you listing just one webapp item or more than one?

When calling the webapp in the template you just need to load the webapp item/s dinamically with somehtinng like itemId="{{category/id}}"

Depending on if you are just listing one item or all the items in a category you may assign/create {{category/id}} in differents ways.

By creating a liquid variable in the page with the category/itemid value, by generating the value dinamycally from some data in the page, you can also have another weapp to handle the clasifications Depends on what you need to list from the webapp and the stie architecture and on your clients skills when creating a new page.

But I think that there is no need to have a template for each page if they have a different banner.

Hope it helps.

Ira

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
Enthusiast ,
May 24, 2015 May 24, 2015

Copy link to clipboard

Copied

I agree with Ira/Machinette,

You certainly do not need a template for each page or web app detail.

What you need to do is find a reference point or marker that will allow you to determine which testimonials need to be displayed on which page, using liquid.

Not knowing the intricacies of the product I can only offer a very broad solution / suggestion:

My suggestion is to name each Testimonial Item the same as the page you want the testimonial to appear. This creates a 1-1 relationship. 1 testimonial for 1 page. Then any page you’re on, load all testimonials into a collection and compare to the current page name.

<body data-pagename=“”>
{module_webapps id=“Testimonials” collection=“testimonials” template=“”}
{% for item in testimonials.items -%}
{% if item.name == pagename -%}

{{ item | json }}

{% endif -%}

{% endfor -%}

It’s you choice what you want to use for the comparison. If you’re talking about web app detail pages, then compare to a reference in the web app, such as web app name, web app itemid or some. There are many option.

Hope this helps.

Stepphen

-

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
Guest
May 26, 2015 May 26, 2015

Copy link to clipboard

Copied

Thanks for the pointers.  I should be able to use that to clean up the code.

Thanks,

Jeff

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
Guest
May 26, 2015 May 26, 2015

Copy link to clipboard

Copied

I was able to successfully implement your suggestions and used Classifications matched to Page Names.

Do you have any further ideas for menus?  There isn't a way to classify a menu as far as I know.  It would be great to not need a separate page template for each sidebar menu as well.

Thanks,

Jeff

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
Enthusiast ,
May 26, 2015 May 26, 2015

Copy link to clipboard

Copied

LATEST

Hi Jeff,

There are many options available to you here too.

Depends how you're making your menus. Are they created directly from the built in menu's module? Because, if you're using webapps, you could always build a contextual menu list directly from you web app list. Here's an example project where services and projects sub menu is built from the list of web app items.

http://www.planningplus.co.nz/services - click on an item to display the web app detail page, and to see the menu in effect. Same with projects.

If you want to use the standard built in menu's, then again, you need a reference point to know when you're on a particular page or set of pages, then display the menu. Use liquid conditionals.

Hope this helps.

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