We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    I use the "getChunks TV" script, btw.

    When I use the Resources link to view the chunks, they are sorted in alphabetical order. Yet when I look at the list of them to add as "TV chunks", it’s in the order I created them in.

    Not a big deal to me, but it makes me wonder why it does that. Maybe it’s due to the getChunks script?
      My Snippets
      -> PopUpChunk v1.0
      • 7923
      • 4,213 Posts
      You need to add "order by name" to the end of the sql sentence that is in getChunk snippet


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 28033
        • 925 Posts
        Could you tell me what the code I should add in? I know little to nothing about MySQL coding (although I know more on a phpMyAdmin-side of things).
          My Snippets
          -> PopUpChunk v1.0
          • 7923
          • 4,213 Posts
          try
          <?php
          $q_chunks = $modx->db->query('
          	SELECT
          		chunk.*
          	FROM modx_site_htmlsnippets AS chunk
          		INNER JOIN modx_categories AS category
          		ON chunk.category = category.id
          	WHERE
          		category.category IN ("'.$category.'")
          	ORDER BY
          		name
          ');
          
          $ar_chunks = array();
          while ($row = $modx->db->getRow($q_chunks)) {
          	$ar_chunks[] = $row['name'];
          }
          
          $l_chunks = implode("||",$ar_chunks);
          return $l_chunks;
          ?>


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 28033
            • 925 Posts
            Yep, that worked perfectly. laugh
              My Snippets
              -> PopUpChunk v1.0