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

Specifically displaying the 3rd latest web app item ONLY using Liquid

Community Beginner ,
Nov 16, 2016 Nov 16, 2016

Copy link to clipboard

Copied

Hi guys,

I have a web app which about 10 items.

I want to display specifically the 3rd item only on my homepage (this would be the 3rd latest by date order in which it was created).

So in the future I will most likely be adding additional web app items, but I always want the homepage to show the 3rd LATEST one only.

So doing it using itemID="individually" will not work for this case.

Any suggestions?

TOPICS
Web apps

Views

482

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

LEGEND , Nov 16, 2016 Nov 16, 2016

If you pass the webapp module as a collection ONLY. Then you have items in the object. This is an array loop of the outputted items.

If you limit the results per page parameter to 3 you will only have 3 items. To get the 3rd item you just target that in the array.

E.G:

{module_webapps id="Banner" resultsPerPage="3" filter="all" collection="myBanners" template=""}

{% assign myItem = myBanners.items[2] -%}

(Since you start at 0 - 0,1,2)

This will give you the item and all its value parameters.

{{myItem.n

...

Votes

Translate

Translate
LEGEND ,
Nov 16, 2016 Nov 16, 2016

Copy link to clipboard

Copied

If you pass the webapp module as a collection ONLY. Then you have items in the object. This is an array loop of the outputted items.

If you limit the results per page parameter to 3 you will only have 3 items. To get the 3rd item you just target that in the array.

E.G:

{module_webapps id="Banner" resultsPerPage="3" filter="all" collection="myBanners" template=""}

{% assign myItem = myBanners.items[2] -%}

(Since you start at 0 - 0,1,2)

This will give you the item and all its value parameters.

{{myItem.name}}

And so on

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
Community Beginner ,
Nov 16, 2016 Nov 16, 2016

Copy link to clipboard

Copied

Thank you!!!

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
Community Beginner ,
Nov 17, 2016 Nov 17, 2016

Copy link to clipboard

Copied

Hi there,

Sorry but upon further investigation, this doesn't seem to be working for me.

I am using this:

{module_webapps id="35136" resultsPerPage="3" filter="all" render="stories" template=""}

{% assign myItem = stories.items[2] -%}

<div style="background-color:#F00; color:#FFF;">

{{myItem.name}}

</div>

My result is just a red box and inside all it says is {{myItem.name}}

Am I doing something wrong?

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
Participant ,
Nov 17, 2016 Nov 17, 2016

Copy link to clipboard

Copied

I think Liam made a typo... all good. Try:

{module_webapps id="35136" resultsPerPage="3" filter="all" collection="stories" template=""}

{% assign myItem = stories.items[2] -%}

<div style="background-color:#F00; color:#FFF;">

{{myItem.name}}

</div>

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
Community Beginner ,
Nov 17, 2016 Nov 17, 2016

Copy link to clipboard

Copied

LATEST

Thank you so much James!!! All good now

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