We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    Quote from: Mark at Jun 07, 2006, 01:17 PM

    Just so everyone knows, the issue was that you need to add the TV to hiddenTVs to make it work. I will fix that in 1.0.2.


    Thanks for noting that as I ran into the same exact issue. Looking forward to 1.0.2... quite handy this feature!
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 17883
      • 1,039 Posts
      Hi Mark,

      thanks for the great improvements smiley

      I discovered a little problem with the altRows/firstRow/lastRow functionality. Let´s say you just want to alter the background color of the rows and you don´t have a determined number of documents to show with ditto yet:

      [[Ditto? &tpl=`DittoTemplate` &startID=`2` &summarize=`50` &tplAltRows=`DittoTemplate_alt` ]]


      In case of 5 (or any uneven number of) documents it works:

      doc1 - DittoTemplate (=firstRow=tpl) -> for example black background

      doc2 - DittoTemplate_alt (=altRow) -> for example white background

      doc3 - DittoTemplate (=Row) -> for example black background

      doc4 - DittoTemplate_alt (=altRow) -> for example white background

      doc5 - DittoTemplate (=lastRow=tpl) -> for example black background

      However, if you add a document the listing breaks:

      doc1 - DittoTemplate (=firstRow) -> black background

      doc2 - DittoTemplate_alt (=altRow) -> white background

      doc3 - DittoTemplate (=Row) -> black background

      doc4 - DittoTemplate_alt (=altRow) -> white background

      doc5 - DittoTemplate (=Row) -> black background

      doc6 - DittoTemplate (=lastRow=tpl) -> black background

      Problem imho is that the first and last row template are defined by default as the "normal" row. And no, it doesn´t make a difference if I define first and last row templates, because at a change of the total number of documents (even or uneven), it will not work.

      You have in ditto.class.inc around line 387:

      	// determine current template
      		$currentTPL = $tpl;
      		if ($format == "rss") {
      			$currentTPLname = "rss";
      		} else
      			if ($format != "archive") {
      				$currentTPLname = "TPL";
      				if ($x % 2) {
      					$currentTPL = $altRows;
      					$currentTPLname = "altRows";
      				}
      				if ($x == 0) {
      					$currentTPL = $firstRow;
      					$currentTPLname = "firstRow";
      				}
      				if ($x == $stop -1) {
      					$currentTPL = $lastRow;
      					$currentTPLname = "lastRow";
      				}
      			}


      I commented out the last two if clauses, so it works for me (because I don´t need first and last row). But I think it would be better to start this routine with first and last row templates not until first and/or last row templates are defined in the snippet call.

      I hope this is understandable wink

      Marc
        • 17883
        • 1,039 Posts
        Erm, didn´t find one, so see the german language file attached smiley

        Regards,
        Marc
          • 18397
          • 3,250 Posts
          [quote author=MadeMyDay link=topic=4951.msg38946#msg38946 date=1151562361]
          I discovered a little problem with the altRows/firstRow/lastRow functionality. Let´s say you just want to alter the background color of the rows and you don´t have a determined number of documents to show with ditto yet:
          


          I have now fixed this in my development code but could you please create a bugtracker entry so this is documented. Thanks!
            • 24292
            • 28 Posts
            Does Ditto handle inherited tvs in chunks or am I doing something wrong?
            I have
            [!Ditto? &startID=`7,30,28` &filter=`tvfrontpage,Yes,=` &hiddenTVs=`frontpage,section` &tpl=`NewsItem`&summarize=`5` &displayArchive=`0` &sortBy=`editedon` &dateFormat=`%A %d %B %Y %H:%M`!] 

            and in NewsItem chunk
            <div class="news post [+tvsection+]Section">
            <h3 class="posttitle"><a href="[~[+id+]~]">[+title+]</a></h3>
            <p>[+date+] [+link+]</p>
            <div>
            [+tvimage+]
            [+introtext+] 
            </div>
            {{clear}}
            </div>

            The template variable section has value @INHERIT default with parent value article.
            If I use ([*section*]) on the page content it appears properly as (article)
            However, in the chunk it ends up as defaultSection instead of acticleSection.
              • 18397
              • 3,250 Posts
              Ditto uses the TV API for that so the issue would be with the core and not Ditto.

              That said, it could be that the @INHERIT is being executed for the page Ditto is being called on and not the article in question. The best person to ask here would be Adam C. since he created @INHERIT.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                I’ve run into that problem before with TVs, the TV for the document you are currently viewing (i.e. your News page in this case) is what will be rendered, you need to be careful about how you handle TVs with Ditto. A TV that you want rendered for a summary, taken from the document of the individual news item, needs to be handled as a placeholder in your summary template.
                  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
                  • 4273
                  • 356 Posts
                  Any idea when the new release of Ditto will be out ? I’m looking forward to being able to use index.php?q= with it
                    SMF Bookmark Mod - check it out
                    http://mods.simplemachines.org/index.php?mod=350
                    • 18397
                    • 3,250 Posts
                    Bugsmi0, If you would like to beta test 1.0.2, shoot me an email.
                      • 4273
                      • 356 Posts
                      cool thanks email sent smiley
                        SMF Bookmark Mod - check it out
                        http://mods.simplemachines.org/index.php?mod=350