We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1122
    • 209 Posts
    Listing documents like

    A | B | C | ... or
    0-9 | A-D | E-J | ... or
    0-9 | A | B-E | F | G,I | H | J-Z | A-Z

    is easily doable with my glossaryFilter -- a custom extender to Ditto. It is small (less than 20 lines of effective code), you can generate required listings with standard Ditto syntax, you can filter document’s pagetitles with the full power of regular expressions, and there is no need to interfere into Ditto’s core code.

    Article, examples, download links: http://setpro.pl/software/ditto-stuff/glossary-extender

    The following is a brief info on using extender copied/pasted from extender’s header.

    Parameters:
    filterVar - optional; documents attribute or template variable used for matching (default: pagetitle)
    notice: you should rather avoid to use content field for this purpose
    filterMode - optional; specifies how matching should be performed
    possible values are:
    class (default) - match with RegExp /^[...]/i where ... is substituted with the value of filterBy parameter
    custom - match with full-fledged RegExp provided with filterBy parameter
    chunk - match with full-fledged RegExp privided with a chunk whose name is kept within filterBy parameter
    filterBy - optional, however, you SHOULD specify at least this one parameter, otherwise extender does no filtering
    Example:
    fetch documents within 3, 4, and 5 containers whose pagetitles start with A, B, C, or D
    [[Ditto? &parents=`3,4,5` &depth=`0` &display=`all` &extenders=`glossaryFilter` &filterBy=`A-D` &tpl=`...` ...]]
    fetch documents within 3, 4, and 5 containers whose aliases do not start with numeric
    [[Ditto? &parents=`3,4,5` &depth=`0` &display=`all` &extenders=`glossaryFilter` &filterVar=`alias` &filterBy=`^0-9` &tpl=`...` ...]]
      • 12379
      • 460 Posts
      Handy - can think of some possible applications already for upcoming projects. Thanks!
        Mostly harmless.
        • 26931
        • 2,314 Posts
        very nice alik! thank you for sharing!
          • 10449
          • 956 Posts
          Very nice! Thanks for sharing. Maybe post it also in the official MODx repository?
            • 25132
            • 129 Posts
            Just used this for a new site. Was exactly what I was looking for. Thanks!!
              • 25132
              • 129 Posts
              A little questions ... is it also possible to create the glossary based on something other than page title? Such as the content of a tv field for example?
                • 1122
                • 209 Posts
                Current version of the extender builds glossaries basing on pagetitle alone. But for tallented programmer who is familiar with MODx it is less than 5 minutes job to adjust (extend) this thing to the above-described behavior.
                  • 25132
                  • 129 Posts
                  Ooops, that’s me out then ;-) Not a php programmer. Will try to play around with it a little and see how far common sense gets me .... Thanks though for the extender as is - already in place on my client site.
                    • 1122
                    • 209 Posts
                    I will implement your suggestions on my own and provide this forum with a newer version, but please be patient for several days. (Due to the heavy professional/family circumstances I cannot start implementation/testing this moment.)
                      • 25132
                      • 129 Posts
                      Very happy to be patient smiley I really appreciate that you are willing to do it! I am sure it will be of great benefit to lots of users. Thanks!!