We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39732
    • 4 Posts
    Hi all,
    I have a Image Carousel that I am dynamically updating but adding two TVs to a template when a user creates a "performances" page (it is for a community theatre). The issue i have is that I need the rel="1" to increase for each item added and only the first one to have the class being equal to "selected". Thought on how I would do this??


    Here is the original HTML
    <div id="m_frame">
                    <ul class="marquetxt">
                                                <li rel="1" class="selected">
                               <div class="btns">
                                <a href="http://acmeavenueqschooledition.brownpapertickets.com/" target="_blank"><img src="http://www.acme.org/assets/images/btn_buy_tickets.png" alt="Buy Tickets"></a> 
                                <a href="http://www.acme.org/performances/shows/avenueq/"><img src="http://www.acme.org/assets/images/btn_learnmore.png" alt="Learn More"></a>
                                </div>
                                <h5>AVENUE Q: SCHOOL EDITION</h5>
                                <h6>Nov 7-17 </h6>
                            </li>
                                                <li rel="2" >
                                <div class="btns">
                                <a href="http://www.acme.org/#" target="_blank"><img src="./assets/images/btn_buy_tickets.png" alt="Buy Tickets"></a> 
                                <a href="http://www.acme.org/performances/shows/roll-in-the-aisles-a-one-act-festival-featuring-w;t.html/"><img src=".//assets/images/btn_learnmore.png" alt="Learn More"></a>
                                </div>
                                <h5>ROLL IN THE AISLES: A ONE ACT FESTIVAL</h5>
                                <h6>Nov 9-16</h6>
                            </li>
                                              
                                        </ul>
                </div>


    I am changing it to:
    <div id="m_frame">
                    <ul class="marquetxt">
                    <li rel="1" class="selected">  <<<THIS IS MY PROBLEM LINE
                    [[getResources? &showHidden=`1` &parents=`20` &limit=`3` &tpl=`Marque` &includeTVs=`1` &includeContent=`1` ]]
                                      </ul>
                </div>


    Here is my TplChunk
      <div class="btns">
                                <a href="[[+tv.TicketLink]]" target="_blank"><img src="http://www.acme.org/assets/images/btn_buy_tickets.png" alt="Buy Tickets"></a> 
                                <a href="[[~[[+id]]]]"><img src="http://www.acme.org/assets/images/btn_learnmore.png" alt="Learn More"></a>
                                </div>
                                <h5>[[+pagetitle]]</h5>
                                <h6>[[+tv.ShowStartDate]] - [[+tv.ShowEndDate]] </h6>
                            </li>
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The whole <li> block should be generated by getResources. Your tpl should start like this:
      <li rel="[[+idx]]" class="selected">
          <div class="btns">
          ...
      </li>
      
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 39732
        • 4 Posts
        Awesome. Thanks


        Quote from: sottwell at Nov 26, 2013, 02:46 PM
        The whole <li> block should be generated by getResources. Your tpl should start like this:
        </li><li rel="[[+idx]]" class="selected">
            <div class="btns">
            ...
        </div></li>