We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25910
    • 26 Posts
    Hi there,

    I'm using a migx addon (to manage several videos in a same resource) with a getImageList snippet:

    [[!getImageList?
                    &toSeparatePlaceholders=`video`
                    &tvname=`myvideos`
                    &tpl=`content.video.tpl`]]
    `]]


    then I use placeholders and place any video in the [[*content]]:

    [[+video.1]]
    [[+video.2]] etc

    Everything works fine until now. My question: Is it possible to pass a parameter in the placeholder like:
    [[+video.1?&size=`200`]]

    and retrieve the «size» parameter in my «content.video.tpl» chunk?


    Or maybe:
    [[+video.1:size=`200`]]

    but I don't know how to start with this «size» snippet


    I would like to avoid using the verbose syntax
    [[newSnippetVideo? &video=`[[+video.1]]` &size=`200` ]]
    the editors might be frightened smiley

    Thanks for your help!
    Sylvain

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I wouldn't think so; placeholders are simply ...um, placeholders to mark a spot where the snippet will insert parts of its output, whether the output has been loaded into the $modx->placeholders array (object?) or not. They don't get processed, so properties wouldn't mean anything. Unless, of course, I'm missing something, which is quite possible wink
        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
        • 25910
        • 26 Posts
        Thank you for your response Susan, I'll find another solution
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Well, keep an eye on this thread, I may be wrong, and hopefully if I am somebody who knows better will post.
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Actually, have you considered using Property Sets? You put all the properties in the Property Set, then just have
            [[newSnippetVideo@PropertSetName]]

            http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/properties-and-property-sets
              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
              • 25910
              • 26 Posts
              Quote from: sottwell at Aug 21, 2013, 08:32 AM
              Actually, have you considered using Property Sets?

              That's a good way to simplify the syntax, thanks for the idea
                • 40590
                • 9 Posts
                saerni, were you able to come up with a good solution to this? I want to do the EXACT same thing with a MIGX TV (when I saw your post I was pleased to see that someone had the exact same idea I had).

                When I thought through the issue on my own, it almost seemed like it would work, but clearly it doesn't. Did you come up with a solution that works within the normal MODX parameters (ie, not a hack or some weird syntax that's counterintuitive.) If Susan's solution helped you, can you describe how you implemented it?

                Best,
                Mike
                  • 25910
                  • 26 Posts
                  Mi Mike,

                  I read your post, dived a last time in this problem, and I found right now a simple solution:

                  I use also a MIGX TV, I simply added a new «width» parameter in the MIGX table.

                  Hope it helps!
                  Regards,
                  Sylvain


                    • 40590
                    • 9 Posts
                    sylvain, thanks for your reply. That solution wouldn't work for my particular needs, because the property I want to pass is a class that i want to manually assign depending upon where in the content the image is. I want to assign it outside of the MIGX table.

                    I ended up taking a different approach, which was to create a container chunk (insertImage) and pass both the [[+MIGX.1]] placeholder AND my class as properties of that chunk. The tag is a little more convoluted than I wanted for use in my blog content, but it's the best solution I could come up with:

                    [[!getImageList?
                    &tvname=`resourcealbum`
                    &tpl=`resourceimage.tpl`
                    &toSeparatePlaceholders=`MIGX`
                    &placeholdersKeyField=`idx`
                    ]]

                    resourceimage.tpl:
                    src="[[+image]]" alt="[[+title]]"

                    Container chunk (insertImage):
                    <img [[+ii.image]] class="[[+ii.class]]" />

                    Calls I use in my blog post content field to render each image where I want it:
                    [[$insertImage? &ii.image=`[[+MIGX.1]]` &ii.class=`full`]]
                    [[$insertImage? &ii.image=`[[+MIGX.2]]` &ii.class=`normal`]]
                    [[$insertImage? &ii.image=`[[+MIGX.3]]` &ii.class=`right`]]

                    etc