We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45642
    • 2 Posts
    That's really strange, i copy exactly the same code but my result is:

    1383817156,1383817162,1383817144,

    I reinstall MIGX, clear cache, but nothing seems to work. Do you have any idea?

    Thanks!
      • 8822
      • 203 Posts
      Hi Bruno, i am not using it inside a getResources-tpl. My TV content for the TV 'recommendations' is:

      [
      {"caption":"Info", "fields": [
          {"field":"name","caption":"Name","inputTV":"nameTV"},
          {"field":"date","caption":"Recommended Date","inputTV":"dateTV"},
      {"field":"facebook","caption":"Facebook link","inputTV":"linkTV"},
      {"field":"facebooktext","caption":"Facebook link text","inputTV":"facebookTV"},
      {"field":"recommendation","caption":"Recommendation","inputTV":"richtextTV"}
      ]}
      ]
      


      Any more ideas?
      Many thanks
        • 8822
        • 203 Posts
        I am still struggling with the above, does anyone have any ideas on how to order getImageList by the dateTV:

        							  						[[!getImageList? 
            							&tvname=`recommendations`
        								&sort=`[{"sortby":"date","sortdir":"ASC"}]`
        		  						&tpl=`@CODE:<li><h3>[[+name]]</h3>
        								<p class="datefacebook">[[+date]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
        								<p>[[+recommendation]]</p></li>
          							`]]

        and the TV content for recommendations is:
        [
        {"caption":"Info", "fields": [
            {"field":"name","caption":"Name","inputTV":"nameTV"},
            {"field":"date","caption":"Recommended Date","inputTV":"dateTV"},
        {"field":"facebook","caption":"Facebook link","inputTV":"linkTV"},
        {"field":"facebooktext","caption":"Facebook link text","inputTV":"facebookTV"},
        {"field":"recommendation","caption":"Recommendation","inputTV":"richtextTV"}
        ]}
        ]

        dateTV is the name of the TV, but it's field name in this instance is 'date' - tried both but neither worked

        Help, hitting my head on this one!
          • 4172
          • 5,888 Posts
          this should work.

          I would like to see the complete generated json-string.
          what is your output when you add the TV-tag to your page:
          [[*recommendations]]


          and did you use the default output-type for this date-TV?

            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 8822
            • 203 Posts
            Hi Bruno,

            The results are below. The TV input and output types are both set to date.

            [{"MIGX_id":"5","name":"Malwina","date":"2013-11-05 20:09:40","facebook":"https:\/\/www.facebook.com\/mdominiczak1","facebooktext":"View Facebook Profile","recommendation":" some text here "},{"MIGX_id":"6","name":"Donna ","date":"2013-11-05 20:16:00","facebook":"https:\/\/www.facebook.com\/donna.104","facebooktext":"View Facebook Profile","recommendation":" some text here "},{"MIGX_id":"7","name":"Caroline","date":"2013-11-05 20:17:54","facebook":"https:\/\/www.facebook.com\/caroline","facebooktext":"View Facebook Profile","recommendation":" some text here "},{"MIGX_id":"8","name":"Donna Bey","date":"2013-11-07 18:14:02","facebook":"https:\/\/www.facebook.com\/donna.bey","facebooktext":"View Facebook Profile","recommendation":" some text here "},{"MIGX_id":"9","name":"Kevin M","date":"2013-11-26 19:53:00","facebook":"https:\/\/www.facebook.com\/Recruitment","facebooktext":"View Facebook Profile","recommendation":"some text here"}]
              • 4172
              • 5,888 Posts
              the output-type should be the default-one not the date-type.
              the output-type is processed before sorting and you will get wrong sort-orders with that.

              Use the date output-filter to format the date-string in your chunk then.

              example:
              [[+date:strtotime:date=`%d.%m.%Y`]]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 8822
                • 203 Posts
                Hi Bruno, just to clarify, do i therefore need to change the output type of the dateTV to 'default' and add the following to my chunk:

                [[!getImageList? 
                    							&tvname=`recommendations`
                								&sort=`[{"sortby":"[[+date:strtotime:date=`%d.%m.%Y`]]","sortdir":"ASC"}]`
                		  						&tpl=`@CODE:<li><h3>[[+name]]</h3>
                								<p class="datefacebook">[[+date]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
                								<p>[[+recommendation]]</p></li>
                  							`]]
                  • 4172
                  • 5,888 Posts
                  change the output-type to default and use it like that:

                  [[getImageList?
                    &tvname=`recommendations`
                    &sort=`[{"sortby":"date","sortdir":"ASC"}]`                                
                    &tpl=`tplRecommendation`
                  ]]


                  and create a chunk 'tplRecommendation' with:

                  <li>
                    <h3>[[+name]]</h3>
                    <p class="datefacebook">[[+date:strtotime:date=`%d.%m.%Y`]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
                    <p>[[+recommendation]]</p>
                  </li>
                  


                  change the date-format (%d.%m.%Y) to your needs.
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 8822
                    • 203 Posts
                    Hi Bruno,

                    Thanks for the above. I have tried what you suggested and it still makes no difference. It still seems to be outputting a date though from the dateTV. If i use the syntax [[+date:strtotime:date=`%d.%m.%Y`]] in my chunk it is blank, if i don't convert to date it displays the date in the format: '2013-11-05 20:09:40'. Why would it still be outputting the dateTV as a date, if the output type is set to 'default' and the input type 'Date' ?

                    Many thanks
                    Emily
                      • 4172
                      • 5,888 Posts

                      It still seems to be outputting a date though from the dateTV
                      ....
                      if i don't convert to date it displays the date in the format: '2013-11-05 20:09:40'
                      ....
                      Why would it still be outputting the dateTV as a date, if the output type is set to 'default' and the input type 'Date'

                      this is ok.
                      This is the unchanged format, how it is stored to the db.
                      MIGX should now sort by that date-field correctly.


                      If i use the syntax
                      [[+date:strtotime:date=`%d.%m.%Y`]] 

                      in my chunk it is blank

                      this is not ok and strange.

                      This output-filter should convert your date:
                      2013-11-05 20:09:40 

                      now to
                      05.11.2013 

                      this is our date-format in Germany


                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!