We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Ok... back-end works fine. There is a problem with the front-end. The list of images displays the titles and descriptions as expected, but each item displays the first image.

    Snippet call
    <ul>
      [[!getImageList? 
        &tvname=`myimages`
        &tpl=`migximage`
      ]]
    </ul>


    Tpl chunk
    <li><img src="[[+image]]" alt="[[+title]]" /><p>[[+description]]</p></li>


    Generated source
    <ul>
      <li><img src="/revo229/assets/images/myimages/./Big-Block_Bargello.jpg" alt="Big-block Bargello" /><p>Big-block Bargello Quilt</p></li><li><img src="/revo229/assets/images/myimages/./Big-Block_Bargello.jpg" alt="Birds in the Forest" /><p>Birds in the Forest quilt</p></li>
    </ul>
      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
      • 34073
      • 34 Posts
      Is there documentation about how MODx takes over http requests to .php files?
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        By itself MODx doesn't. The .htaccess file will rewrite all requests to index.php if friendly URLs is turned on. All pages are generated through the index.php file; all the .php files in MODx are included, not directly accessed.

        If you have a .php file independent of MODx that you want to be able to access directly, you have to exclude it from the .htaccess rewrite rules.
          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
          • 4172
          • 5,888 Posts
          Quote from: sottwell at Feb 29, 2012, 03:59 PM
          Ok... back-end works fine. There is a problem with the front-end. The list of images displays the titles and descriptions as expected, but each item displays the first image.


          I think this results on upgrading from 1.x to 2.x
          There is now a new autoinc - field MIGX_id, which is now the default placeholdersKeyField
          Think I have to change that back and use an empty key for the output-array.

          This field is there, after saving all items again.
          you can try to use

          &placeholdersKeyField=`idx` or &placeholdersKeyField=``

          If you can confirm mediasources are working ok now, I will do an upgrade on the repo.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            No, that doesn't help. The snippet still returns the first image URL as the "image" placeholder value.

            (tpl changed to simply return the "idx" and "image" placeholder in the unordered list)

            1 - /revo229/assets/images/myimages/./Big-Block_Bargello.jpg
            2 - /revo229/assets/images/myimages/./Big-Block_Bargello.jpg
            3 - /revo229/assets/images/myimages/./Big-Block_Bargello.jpg

            That extraneous ./ in the path appears to be caused by the Media Source/TV itself; it's also part of the filename for a plain image TV and is stored in the database with the ./ prepended.

            As far as I can see, the Media Sources are working as expected. [ed. note: sottwell last edited this post 14 years, 7 months ago.]
              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
              • 4172
              • 5,888 Posts
              strange.
              what is the output of your tv?
               [[*myimages]]


              As a quick fix to remove the unwanted './' , I changed this line in getImageList
              $value = $mediasource->prepareOutputUrl($value);

              to
              $value = str_replace('/./','/',$mediasource->prepareOutputUrl($value));


              the filebrowser seems to add this, when opened at the mediasources root.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}] 


                It's correct in the database; it's just not looping correctly in the tpl processing. I haven't been able to follow the code well enough to figure out where it's doing this. [ed. note: sottwell last edited this post 14 years, 7 months ago.]
                  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
                  • 4172
                  • 5,888 Posts
                  when I put your json into a getImageList-call

                  [[!getImageList? 
                  &tvname=`migx1` 
                  &value=`[{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                  {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                  {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]` 
                  ]]
                  



                  I get:

                  Array
                  (
                      [MIGX_id] => 4
                      [title] => Big-block Bargello
                      [description] => Big-block Bargello Quilt
                      [image] => /assets/images/Big-Block_Bargello.jpg
                      [_alt] => 0
                      [_first] => 1
                      [_last] => 
                      [idx] => 1
                      [property.tvname] => migx1
                      [property.value] => [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                  {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                  {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]
                  )
                  
                  Array
                  (
                      [MIGX_id] => 5
                      [title] => Birds in the Forest
                      [description] => Birds in the Forest quilt
                      [image] => /assets/images/Bird_Forest.jpg
                      [_alt] => 1
                      [_first] => 
                      [_last] => 
                      [idx] => 2
                      [property.tvname] => migx1
                      [property.value] => [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                  {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                  {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]
                  )
                  
                  Array
                  (
                      [MIGX_id] => 6
                      [title] => Bejeweled
                      [description] => Bejeweled quilt
                      [image] => /assets/images/Bejeweled.jpg
                      [_alt] => 0
                      [_first] => 
                      [_last] => 1
                      [idx] => 3
                      [property.tvname] => migx1
                      [property.value] => [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                  {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                  {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]
                  )
                  
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 34073
                    • 34 Posts
                    For my issue it was Apache refusing to execute .php files that are group writeable so MIGX acted as a wonderful agent to inform us of a server misconfiguration!
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Then something is wrong, because if I do that (using the myimages TV) I get

                      Array
                      (
                          [MIGX_id] => 4
                          [title] => Big-block Bargello
                          [description] => Big-block Bargello Quilt
                          [image] => /revo229/assets/images/myimages/Big-Block_Bargello.jpg
                          [_alt] => 0
                          [_first] => 1
                          [_last] => 
                          [idx] => 1
                          [property.tvname] => myimages
                          [property.value] => [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                      {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                      {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]
                      )
                      
                      Array
                      (
                          [MIGX_id] => 5
                          [title] => Birds in the Forest
                          [description] => Birds in the Forest quilt
                          [image] => /revo229/assets/images/myimages/Big-Block_Bargello.jpg
                          [_alt] => 1
                          [_first] => 
                          [_last] => 
                          [idx] => 2
                          [property.tvname] => myimages
                          [property.value] => [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                      {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                      {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]
                      )
                      
                      Array
                      (
                          [MIGX_id] => 6
                          [title] => Bejeweled
                          [description] => Bejeweled quilt
                          [image] => /revo229/assets/images/myimages/Big-Block_Bargello.jpg
                          [_alt] => 0
                          [_first] => 
                          [_last] => 1
                          [idx] => 3
                          [property.tvname] => myimages
                          [property.value] => [{"MIGX_id":"4","title":"Big-block Bargello","description":"Big-block Bargello Quilt","image":"Big-Block_Bargello.jpg"},
                      {"MIGX_id":"5","title":"Birds in the Forest","description":"Birds in the Forest quilt","image":"Bird_Forest.jpg"},
                      {"MIGX_id":"6","title":"Bejeweled","description":"Bejeweled quilt","image":"Bejeweled.jpg"}]
                      )
                      
                        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