Developer forum

Forum » Feature requests » A Count tag on Loops

A Count tag on Loops

Sten Hougaard
Reply

Hi,

Not sure if I (or another) have requested this before :-)

I would love to get a tag which is a counter of the number of items in a loop.

Reading the documentation http://templates.dynamicweb.com/TemplateTags/Dynamicweb-template-tags/General-tags/Loops.aspx I see only a count which is inside of the loop and which only shows the position of the current item.

The new tag could be named:

LoopCount.[loop name]

For instance:

LoopCount.products


Med venlig hilsen/Best regards,

Sten Hougaard
Webudvikler


Replies

 
Rasmus Pedersen
Reply

This would be helpful

 
Nicolai Høeg Pedersen
Reply

What about Razor?

GetLoop("Whatever") returns a List Generic.List(Of LoopItem) so you do like this:

GetLoop("Whatever").Count

 
Sten Hougaard
Reply

I know that Razor supports such feature, but does Dynamicweb no longer support other than Razor solution? :-)

I now have received a couple of replies from Dynamicweb asking me to switch to Razor, however you should know that switching to Razor on already implemented templates using say HTML is not always a simple task. Asking the customer to pay hours for a change like that will often resolve in a "no thanks" from the customer.

So a wish for a generic new property which should work "everywhere" (HTML, XSLT and Razor) is still a wish of mine :-)

/Sten

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

We do support HTML.

But we should also be careful with the HTML rendering engine. It is string based and loading it with too much information will kill performance. So all the 'advanced' stuff that you can already do with Razor we consider to put into the html engine. Problem is that HTML based templates needs all data in the rendering engine and Razor can get the data 'on-demand' - the latter is much better for performance. So us not wanting to add it is beacuse we want to protect against bad performance.

Also adding the new tag would require your customer to upgrade the solution and wait for the feature to arrive - switching to Razor is usually done within a few minutes in most scenarios.

BR Nicolai

Votes for this answer: 1