We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27117
    • 28 Posts
    Hello

    Maybe a dump question but what exactly does the property &outputSeparator do? I can’t find any infos about that in the documentation.

    Thx
      Modx 2.1.3, PHP 5.2
      • 22019
      • 390 Posts
      From the getResources snippet comments :

      outputSeparator - (Opt) An optional string to separate each tpl instance [default="\n"]


      ie - defaults to adding a new line between ’rows’.
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 27117
        • 28 Posts
        Thank you Ivan.

        Does that mean, that I can write something similar like this: &tpl_1=, &tpl_5=, &tpl_7=`mytemplate` &outputSeparator=`,` ?

        thx
          Modx 2.1.3, PHP 5.2
          • 22019
          • 390 Posts
          Doesn’t look like it. My reading (I’ve not used it) says it separates the output (each processed row) with /n.

          If you only want a tpl to apply to the 7th item, then (again, untested) it should only need a default tpl, and tpl_7 to be set.

          If you only want to output the 7th item, then you need to add an offset.
            Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
            • 27117
            • 28 Posts
            It’s also my experience that it doesn’t work. I just tried it and it just takes the last &tpl_n

            What I like to do is the following:

            template 1 for resources 1,4,7,10...
            template 2 for resources 2,5,8,11...
            template 3 for resources 3,6,9,12...

            in fact, there are a whole lot more resources but I think you see what I like to do.

            Any idea, how to do something like that?

            thx
              Modx 2.1.3, PHP 5.2
              • 22019
              • 390 Posts
              You’re going to have to customise the getResources snippet to do that, either by changing how existing tpl values are treated or creating some of your own - tpl_patternA, tpl_patternB, tpl_patternC and checking the idx of the returned rows in a way that returns A,B or C instead of odd,even,first,last or specific index.

              The template parsing starts at line 221.

              Well beyond my capabilities to do this in the time I have at present.
                Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                • 27117
                • 28 Posts
                Thank you Ivan, this gives my an idea where and how to start to solve this problem.

                But also my time is limited for the moment.

                Anyway, thank you for your help!
                Cheers
                  Modx 2.1.3, PHP 5.2
                  • 22019
                  • 390 Posts
                  A clunky workaround - if all you’re doing is styling the rows differently, would be put redundancy into the CSS file and have one tpl that outputs class=’rowid_N’ and then set your CSS rules
                  .rowid_1, .rowid_4, .rowid_7, etc {
                  color: red;
                  }
                  .rowid_2, .rowid_5, .rowid_8 {
                  color: green;
                  }

                  etc ie just add as many class numbers as you can be bothered to....

                    Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                    • 27117
                    • 28 Posts
                    Thats a nice solution. I’ll give it a try.

                    Thanks!
                      Modx 2.1.3, PHP 5.2