1 Reply Latest reply on May 20, 2014 10:17 AM by BriceShatzer

    Looping through items in a web app


      Hi there,


      On this site - http://www.dandmrural.com.au/


      Where it reads Latest news, I have each news piece setup as a content holder with a piece of javascript looping through them.


      I want to modify this to use Web apps so the client can add and remove items themselves and have them looping through as they do now.


      Using a Webapp I have access to {module_webapps,20117,a} which lists out all the items and {module_webappscount,20117} which gives me a count of the number of items.


      Can someone please give me some pointers on how to go about migrating from a content holder setup to using webapps.


      Thanks, Ben

        • 1. Re: Looping through items in a web app

          Your first step should be to customize the web app item list layout to match how each item is rendered in the shared content holder. From there, you should recreate each news item as an individual web app items. Finally, replace the content holder with the web app item list module ( {module_webapps,20117,a} ). It appears that the script that is responsible for handling the looping can be found here and is not relying on any sort of fixed number to control the transitions. Instead, it simply is looking for any divs which have an id that begin with "content-" and fades them in & out in whatever order it finds them until it reaches the final item and then starts over.


          Additionally, I would recommend adding some sort of incremental counter to your div id within your list template. Currently, the divs which contain each of the three news items share the same id attribute of "content-" which is not something you want.

          Something like this in your list layout should do the trick:

          <div id="content-{tag_counter}">