We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20413
    • 2,877 Posts
    I meant your site template, and if let say you wanted to let the client choose to highlight
    one of the listing items showing on your start page. He would have to calculate how many to skip
    and set that in a number-TV. The problem with this would be the pagination only applying to one ditto (3rd).
    But if we are talking about a set number of items maybe you don’t even need pagination.
      @hawproductions | http://mrhaw.com/

      Infograph: MODX Advanced Install in 7 steps:
      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
      • 12379
      • 460 Posts
      OK, I’ve gotcha. So basically below the second Ditto call definites the unique template, and the third carries on with the same template from the first Ditto call.

      [[Ditto? &startID=`0` &id=`one` &tpl=`layout_cell_sidebar_tpl` &display=`1` &orderBy=`menuindex ASC` &depth=`1` &showInMenuOnly=`1`]]
      [[Ditto? &startID=`0` &id=`two` &tpl=`layout_cell_tpl` &start=`1` &display=`1` &orderBy=`menuindex ASC` &depth=`1` &showInMenuOnly=`1`]]
      [[Ditto? &startID=`0` &id=`three` &tpl=`layout_cell_sidebar_tpl` &start=`2` &display=`3` &orderBy=`menuindex ASC` &depth=`1` &showInMenuOnly=`1`]]


      And btw, don’t worry about the "user defined" bit - I did’t want the actually user to determine the template - I’m copying Ditto’s instruction terminology for defining &tpl:

      tpl
      Purpose

      User defined chunk to format the documents
      Options

      * Any valid chunk name
      * Code via @CODE
      * File via @FILE

      Default

      [LANG]
        Mostly harmless.
        • 4172
        • 5,888 Posts
        aah, I see what you want. As mrhaw said, you can use phx for that in your ditto-chunk layout_cell_sidebar_tpl:

        [+ditto_iteration:is=`1`:then=`
        
        here your code for layout_cell_tpl
        
        
        `:else=`
        
        here your normal code for  layout_cell_sidebar_tpl
        
        `+]
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 12379
          • 460 Posts
          um, ok so I’ve created a new chunk called it "cell" and added this:
          [+ditto_iteration:is=`1`:then=`
          
          <!--layout_cell_tpl-->
          <h2 id="[+title+]"><a href="[~[+id+]~]">[+longtitle+]</a></h2>
          <div class="cell rounded_corners clearfix">
          <div class="intro-head full-width">
          [+introtext+]
          </div>
          
          <div class="full-width">
          [+content+]
          </div>
          <!-- end .full width -->
          
          <div class="footer">
          {{footer}}
          </div>
          </div>
          
          `:else=`
          
          <--layout_cell_sidebar_tpl-->
          <h2 id="[+title+]"><a href="[~[+id+]~]">[+longtitle+]</a></h2>
          <div class="cell rounded_corners clearfix">
          
          <div class="intro-head full-width">
          [+introtext+]
          </div>
          
          <div class="main">
          [+content+]
          </div>
          
          <div class="sidebar">
          [+sidebar_content+]
          </div>
          
          <div class="footer">
          {{footer}}
          </div>
          
          </div>
          <!-- end .cell -->
          
          `+]


          Then in the page template I have the Ditto call:

          [[Ditto? &startID=`0` &tpl=`cell` &display=`5` &orderBy=`menuindex ASC` &depth=`1` &showInMenuOnly=`1`]]


          But nothing - is there supposed to be some phx code in the Ditto call?
            Mostly harmless.
            • 4172
            • 5,888 Posts
            what do you mean with nothing?
            No output at all? Or what.
            And .... what is the difference between layout_cell_sidebar_tpl and layout_cell_tpl

            seems to me there is no difference??

            [Edit]

            Try:

            <h2 id="[+title+]"><a href="[~[+id+]~]">[+longtitle+]</a></h2>
            <div class="cell rounded_corners clearfix">
            <div class="intro-head full-width">
            [+introtext+]
            </div>
            <div class="[+ditto_iteration:is=`1`:then=`full-width`:else=`main`+]">
            [+content+]
            </div>
            <div class="footer">
            {{footer}}
            </div>
            </div>
            
            
            
            
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 12379
              • 460 Posts
              Thanks - the way to do this is slowly become clearer. The difference is...

              layout_cell_sidebar_tpl has:
              <div class="main">
              [+content+]
              </div>
              
              <div class="sidebar">
              [+sidebar_content+]
              </div>


              where layout_cell_tpl has:

              <div class="full-width">
              [+content+]
              </div>
              <!-- end .full width -->


              ie one has a left column with right sidebar and the other just a full width div.
                Mostly harmless.
                • 12379
                • 460 Posts
                You could do (inside tpl):
                [+phx:if=`[+ditto_iteration+]`:ne=`2`:or:ne=`3`:then=`
                Content
                `:else=`
                Content for 3rd and 4th item
                `+]

                Weird, I’ve just been playing around with ditto_iteration solution given at the beginning of this post and have found this quirk. It only worked after I’d inserted "item_[+ditto_iteration+]" into the class attribute, otherwise it was incorrectly giving me the "else" code for iteration counts of "2" or "5".

                blog_post_summary_tpl:

                [+phx:if=`[+ditto_iteration+]`:is=`2`:or:is=`5`:then=`<div id="[+alias+]" class="item_[+ditto_iteration+] colright span1">`:else=`<div id="[+alias+]" class="item_[+ditto_iteration+] col span1 gutter">`+]
                
                <h3><a href="[~[+id+]~]" title="[+longtitle+]">[+pagetitle+]</a></h3>
                <p><span class="post-date">Posted on [+date+].</span></p>
                <p>[+introtext+]
                <a href="[+url+]"> Read more...</a>
                </p>
                </div>


                The ditto call was:

                [[Ditto? &startID=`2` &id=`wp` &tpl=`blog_post_summary_tpl` &display=`6` &depth=`3` &paginateAlwaysShowLinks=`0` &showInMenuOnly=`1` &hideFolders=`1` &dateSource=`createdon` &showPublishedOnly='1' &dateFormat=`%A, %B %d %Y  at %l:%M %p` &sortBy=`createdon` &sortDir=`DESC` &extenders=`dateFilter` &paginate=`1` &paginateAlwaysShowLinks=`1` &seeThruUnpub='1']]


                  Mostly harmless.