We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27890
    • 3 Posts
    I think I’ve found a logical flaw / bug in Ditto 1.0.2.

    I tried to do the following:
    [tt][!Ditto? &tpl=`DittoTemplateNorsk` &startID=`4` &summarize=`2` &trunc=`0` &truncSplit=`0` &displayArchive=`0` &sortBy=`pub_date`!]

    BANNER

    [!Ditto? &tpl=`DittoTemplateNorsk` &startID=`4` &start=`2` &summarize=`2` &trunc=`0` &truncSplit=`0` &displayArchive=`0` &sortBy=`pub_date`!]

    BANNER

    [!Ditto? &tpl=`DittoTemplateNorsk` &startID=`4` &start=`4` &summarize=`5` &trunc=`0` &truncSplit=`0` &displayArchive=`0` &sortBy=`pub_date`!]
    [/tt]
    i.e.:

    • Show the 2 newest articles (&summarize=`2`)
    • display a banner
    • display two more articles (&start=`2` &summarize=`2`)
    • display a banner
    • display five more articles (&start=`4` &summarize=`5`)

    This will not work since the loop (on line 405) displaying the articles runs from &start to &summarize. To fix this, I’ve applied this patch to my installation (line 126-132):
    if ($paginate == 1 && $_GET['start'] != 0) {
    	$start= isset($_GET['start'])? $_GET['start']: 0;
    		// get post # to start at
    }else{
    	$start = isset($start) ? $start : 0;
    		// get start number
    	$summarize = $summarize + $start; // MY PATCH, incrementing summarize with $start
    }


    I’m rather new to MODx and Ditto so I might be wrong, please comment.

    ../Per
      • 22815
      • 1,097 Posts
      If this is how Ditto works, then rather than hacking Ditto, you could surely just change your &summarize values to 2, 4, 9.
        No, I don't know what OpenGeek's saying half the time either.
        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
        Forum: Where to post threads about add-ons | Forum Rules
        Like MODx? donate (and/or share your resources)
        Like me? See my Amazon wishlist
        MODx "Most Promising CMS" - so appropriate!
        • 27890
        • 3 Posts
        Quote from: PaulGregory at Jul 29, 2006, 11:01 AM

        If this is how Ditto works, then rather than hacking Ditto, you could surely just change your &summarize values to 2, 4, 9.

        I know, but that’s not logical i.e. hard for others to understand what I’m trying to do when they read the code.
        • Just think of the &summarize field to mean the end point (summarize through) and &start to mean the beginning point.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 18397
            • 3,250 Posts
            Yes, technically you are correct but note that Ditto was not coded to completly use &start without pagination enabled. I have made some changes in the dev code to make this work properly. Thank you for bringing it to my attention.
              • 27890
              • 3 Posts
              Quote from: Mark at Jul 29, 2006, 08:23 PM

              Yes, technically you are correct but note that Ditto was not coded to completl use &start without pagination enabled. I have made some changes in the dev code to make this work properly. Thank you for bringing it to my attention.

              Maybe a &from and &numelements param would be better, to separate it from the &start pagination ?

              Anyway, thumbs up for Ditto and MODx smiley
                • 18397
                • 3,250 Posts
                The &start $_GET and the &start snippet param are separated in the new code quite nicely. Nothing to worry about,