Developer forum

Forum » Feature requests » ItemPublisher:Items.TotalCount similar tag needed for itemlists

ItemPublisher:Items.TotalCount similar tag needed for itemlists

Jacob Storgaard Jensen
Reply

Hi this tag: ItemPublisher:Items.TotalCount

We need something similar when rendering an itemlist :-)


Replies

 
Mikkel Ricky
Reply

You can already do this using Razor templates.

Use this to check if the list of items is not empty:

@if (GetLoop("Item.ListOfSomething").Any())
{
  <ol class="items">
    @foreach (var item in GetLoop("Item.ListOfSomething"))
    {
      <li>@item</li>
    }
  </ol>
}

Use this to get the actual number of items:

<pre>#items: @GetLoop("Item.ListOfSomething").Count</pre>

Best regards,
Mikkel