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?
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
...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
Copy link to clipboard
Copied
Thank you!!!
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?
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>
Copy link to clipboard
Copied
Thank you so much James!!! All good now