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

Display only certain Web App items?

New Here ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Hi,

Imagine we have a Web App that has a dropdown field called "Location" with the options Melbourne, Adelaide, Sydney etc.

It is possible to create a new Page with the Web App module on the page to display only the items that have the web app items that have the option "Melbourne" selected?

As in I only want to output only the web app items that have the Melbourne option selected onto the page. All of the other items (ones with Adelaide selected, Sydney selected etc.) to not display on the page? It should not even be in the source code either.

Is something like this possible with Liquid?

Because at the moment all I am doing is just:

{module_webapps id="123456" filter="all"}

And then just "display:none;" on the items I don't want to appear on the page, but this is not really ideal because even though you can't see it on the page, it can still be read in the source code.

I know this is possible using Classifications and then displaying the {module} with the classification but I do not want to use this method.

Thanks!!

TOPICS
Web apps

Views

595

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

Guide , Nov 18, 2015 Nov 18, 2015

You can do something like that with if statements in Liquid.

This is the concept:

<!-- Web App code, change to fit your need (such as sortType, number per page, etc. -->

{module_webapps id="123456" filter="all" resultsPerPage="500" sortType="date" collection="location" template=""}

<!-- FOR LOOP TO LOOP OVER THE COLLECTION -->

{% for i in location.items -%}

    {% if i.['Location'] == 'Melbourne' -%}

        <!-- Now only web app items with the Location set to Melbourne will show below. -->

      

     

...

Votes

Translate

Translate
Guide ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

You can do something like that with if statements in Liquid.

This is the concept:

<!-- Web App code, change to fit your need (such as sortType, number per page, etc. -->

{module_webapps id="123456" filter="all" resultsPerPage="500" sortType="date" collection="location" template=""}

<!-- FOR LOOP TO LOOP OVER THE COLLECTION -->

{% for i in location.items -%}

    {% if i.['Location'] == 'Melbourne' -%}

        <!-- Now only web app items with the Location set to Melbourne will show below. -->

      

        <!-- Code for your web app item -->

    {% endif -%}

{% endfor -%}

  

Of course, you do not have to use a collection, you could put the if statement in any layout and it would work.

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
New Here ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

Thanks for your reply but am having problems getting it to work.

Have created a test.tpl file and added the following code:

{% for i in location.items -%}

    {% if i.['Location'] == 'Melbourne' -%}

<p>{tag_name}-{tag_location}</p>

    {% endif -%}

{% endfor -%}

Am I missing something? Sorry about this but I am a bit of a noob when it comes to javascripting/liquid!

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
Guide ,
Nov 18, 2015 Nov 18, 2015

Copy link to clipboard

Copied

LATEST

What does your module_webapps look like?

Also, use the Liquid tags within the test.tpl file.

For example:

{tag_name} would be: {{name}}, however, since it is in a for loop it needs to be:

{{i.name}}

The same for location. I assume location is the custom dropdown you have defined?

It would be like this:

{{i.['Location']}}

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