We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23703
    • 180 Posts
    &tplLastRow doesn’t seem to work. The last item in my list uses the default template. The Ditto call looks like this
    [[Ditto? &language=`svenska` &tpl=`smallist` &startID=`2` &summarize=`all` &tplLastRow=`smallistend`]]


    If I change line 231 in ditto.class.inc.php to this
    231  if ($x == $stop -2) {

    the second to last item is formated with the template specified in &tplLastRow so the template works. I just can’t get it to work on the last item.
    Could this be an issue with the functionality for alternate rows?

    UPDATE
    I tried this with different values for &summarize and the problem occurs for even numbers. The problem is in the getCurrentTPL function and the order of the if-statements.

    The following fixes the issues. I hope...
    	function getCurrentTPL($x, $stop, $id, $format, $templates) {
    		global $modx;
    		// determine current template
    		$currentTPL = "default";
    		if ($x == 0) {
    			$currentTPL = "tplFirstRow";
    		}
    		if ($x % 2) {
    			$currentTPL = "tplAltRows";
    		}
    		if ($x == $stop -1) {
    			$currentTPL = ($x % 2 && $templates["tplLastRow"] == $templates["default"]) ? "tplAltRows" : "tplLastRow";
    		}
    		if ($id == $modx->documentObject['id']) {
    			$currentTPL = "tplCurrentDocument";
    		}
    	return $currentTPL;
    	}


      • 23050
      • 1,842 Posts
      Hi there,

      Let’s take the following document tree :

      - Folder A (id 25)
      - SubFolder 1 (id 26)
      - Document A (id 33) published on 10/Oct/2006
      - Document B (id 31) published on 05/Oct/2006
      - SubFolder 2 (id 27)
      - Document C (id 32) published on 08/Oct/2006
      - Document D (id 30) published on 02/Oct/2006
      - SubFolder 3 (id 28)
      - Document E (id 29) published on 01/Oct/2006

      I call the snippet :
      [!Ditto? &startID=`25` &tpl=`BlogArticlesAccueil` &tplAltRows=`BlogArticlesAccueil2` &summarize=`4` &dateFormat=`%d/%m/%Y %H:%M` &displayArchive=`0` &depth=`2` &hideFolders=`1` &sortBy=`pub_date`!]


      The output should be (if I understand the snippet) : Doc A - C - B - D
      But it is : A - B - C - D
      In fact, it looks like the snippet sort into each SubFolders and not into all SubFolders.

      If I use, &sortBy=`id`, the output is right : Doc A - C - B - D
        • 16429
        • 254 Posts
        I’m getting this error, but I don’t understand if this is caused by the MySQL bug (I’m on MySQL 4.1.21):
        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « Execution of a query to the database failed - Unknown column 'sc.pubdate' in 'field list' »
              SQL: SELECT DISTINCT sc.pubdate,sc.id FROM `kudkuro_selleri`.modx_site_content sc LEFT JOIN `kudkuro_selleri`.modx_document_groups dg on dg.document = sc.id WHERE (sc.parent IN (2) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privateweb=0) ORDER BY sc.pubdate DESC 
        

        I’ve changed the files discussed here but this does not fix the problem. I’ve try to use the "GROUP BY" fix in the function.class.inc.php where this query is created but it doesn’t fix the problem, too.

        My fault. I didn’t recognize I’ve 2 ditto calls on the same page, and the one I forgot have "pubdate" instead of "pub_date". That was throwing the error.
        Ehehehe... rolleyes ... ehm... gosh! lipsrsealed
          kudo
          www.kudolink.com - webdesign (surprised?)

          [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
          • 25059
          • 47 Posts
          Hi there...
          Great improvement of Ditto wink

          Something I would like to do. I’ve tried on previous Ditto’s version since I installed this one. My problem is with filters.
          With tagMode, we can control the comportement. But there’s one that is not implemented.
          I use multiple tags (2 and more) with Tv.
          When you use "onlyTags", it selects pages with one of them.
          When you use "onlyAllTags", it selects pages only if you gave it all the tags of the Tv.

          What I want to do, is to select pages with all the tags that I put in my url.

          An exemple:
          Tv Page1: test1,test2,test3
          Tv Page2: test2,test3,test4


          • Url: &tags=test1,test2 -> result: Page1 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
          • Url: &tags=test2,test3 -> result: Page1 AND Page2 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
          • Url: &tags=test3,test4 -> result: Page2 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
          • Url: &tags=test1,test4 -> result: none (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
          • Url: &tags=test1,test2,test3 -> result: Page1 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> Page1)

          I’ve tried to hack filters, but nothing like this for the moment :/

          (sorry for my english :p)
            :: RiderCrazy.Com :: Server@Home - [WIP] En cours de transition vers MODx
            • 999
            • 67 Posts
            can i use url variables with ditto?

            <tr>
            <td width="40"><a href="index.php?id=[+id+]&issue=[+id+]"><img src="Images/arthra/TITLEbgrndarrow.jpg" width="40" height="39" border="0"/></a></td>
            <td width="315" background="Images/arthra/TITLEbgrnd.jpg"><a href="index.php?id=[+id+]&issue=[+id+]"><span class="TitleCapsRED">[+title+]</span></a></td>
            </tr>

            what if in here i wanted to get the value of an url variable passed?

            alex.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It’s a chunk. Make a snippet to grab and return your $_GET value (or have the snippet put it in a placeholder), and put it in the chunk where you want it.
                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
                • 18436
                • 135 Posts
                Quote from: PaulGregory at Sep 19, 2006, 05:24 PM


                @Marschant: I guess we’re hoping to use Reflect for the blog archive page in the 0.9.5B3 default content - once we have that together, I want to make sure we document and explain how it is done there.


                Any progress or feedback on this yet, I’m hoping to launch the new issue of site using 0.9.5 BETA3 and so far the only thing holding me up is the lack of a blog archive, I can theoretically unpublish the page but really don’t want to go down that route just yet...
                  • 16083
                  • 28 Posts
                  Hi,


                  Quote from: kneehat at Oct 06, 2006, 05:17 AM

                  I’ve just moved from Ditto 1.0.2 to 1.1 Beta in order fix a problem which cropped up with the sort ordering.
                  Anyway, I’ve just discovered a bit of an issue. I have a certain Ditto call which turns off normal truncation and ’truncation at the splitter’, and use it to summarise articles which DO have the splitter string in them.

                  Is there any news on this issue? Is there something I can do to help track it down and fix it?
                    • 18397
                    • 3,250 Posts
                    @heliotrope: Any time depth is used, an extra API function must be used to search an array of all the documents ids compared to their parents. This will always be slower than manually specifying the IDs. However, it should not take >20 seconds for what you describe. I would have guessed about 5 or 6.

                    @kneehat: noted, will take a look and turn off tag closing when dealing with the splitter

                    @Pont: will look into this and ammend the codebase if needed.

                    @Perrine: pub_date depending on the MODx version is sometimes default set to 0.

                    @AlexKay: Yes, that should work. If you wanted the value of the url you would need to use some code that will be in Beta 2 (coming soon to a MODx install near you!)

                      • 8471
                      • 333 Posts
                      Hi, I can’t understand how work Reflect, which are the parameters?
                        Sorry for my bad English grin

                      This discussion is closed to further replies. Keep calm and carry on.