Developer forum

Forum » Development » How to implemen loops the way DW do in e.g. Weblog or eCommerce

How to implemen loops the way DW do in e.g. Weblog or eCommerce


Reply

Hi,


 


how to implement Loops like DW do in some of the new modules?


 


- Gunnar


Replies

 
Nicolai Høeg Pedersen
Reply

Dim myTemplate As New Templatev2.Template("SomeTemplateFolder/SomeTemplate.html")


myTemplate.SetTag("Sometag", "SomeValue")


 


Dim loopTemplate As Templatev2.Template = myTemplate.GetLoop("NameOfLoop")


 


For i As Integer = 0 To 5


loopTemplate.SetTag("Counter", i)


loopTemplate.CommitLoop()


Next


 


Dim outPut As String = myTemplate.Output


 


The template then looks like this:







 

You must be logged in to post in the forum