We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Dear modx people,

    I am currently trying to pass an url parameter to an iframe. I am using getUrlParam Snippet for this. I cant figure out, how to combine the output of the snippet with the native output modifier. Its the second line that I'm struggeling with.

    <iframe src="http://somesite/assets/components/lists/?p=
    [[!getUrlParam? &name=`p`]]
    [[[[!getUrlParam? &name=`uid`]]:isnot=``:then=`&uid=[[!getUrlParam? &name=`uid`]]`]]
    " height="400" width="100%" name="Newsletter" style="overflow:hidden;">
     <p>Iframe is important here and there. You can't display them with your current computer. Please ask some young guy in your neighbourhood to help you out.</p>
    </iframe>


    Any help would be great!

    Best regards,

    Guido [ed. note: gallenkamp last edited this post 11 years, 7 months ago.]
    • I must add that the
      <a href
      from the code quote is NOT in my code but comes with the forum here.
      • Got it working. I used the "switch" snippet which comes with the flexibility package:

        <iframe src="http://somesite/assets/components/lists/?p=
        [[!getUrlParam? &name=`p`]]
        		[[switch?
        		&get=`[[!getUrlParam? &name=`uid` &max=`32`]]`
        		&c1=``
        		&do1=``
        		&default=`&uid=[[!getUrlParam? &name=`uid` &max=`32`]]`
        		]]
        " height="400" width="100%" name="Newsletter" style="overflow:hidden;">
         <p>Iframe is important here and there. You can't display them with your current computer. Please ask some young guy in your neighbourhood to help you out.</p>
        </iframe>
        • When I call this:
          [[!getUrlParam:is=``:then=`subscribe`:else=`[[!getUrlParam? &name=`p`]]`? &name=`p`]]

          I get "subscribesubscribe" as the result.

          Any clues?
            • 40045
            • 534 Posts
            Have a similar problem with

            [[!UltimateParent:is=`1`:then=`i'm a child of 1`:else=`i'm NOT a child of 1`]]
            


            wich gives the output (on a non-child of 1) -> notice the parentesis...

            i'm NOT a child of 1`]]
            



            what is wrong there...I even stripped yout the params via ? &id=...

            but it didn't help...any ideas what I'm doing wrong or is it just not possible to do conditional stuff with a snippet output?


            EDIT: Just solved it in another way (which may not work in another scenario...) like most of the time possible in MODx =)...

            Found the snippet for a custom outputmodifier :docfield

            <?php 
            $options = strlen($options) ? $options : 'id'; 
            $resource = $modx->getObject('modResource',$input); 
            return is_object($resource) ? $resource->get($options) : "";
            


            and used it like this:

            [[*parent:docfield=`parent`:is=`1`:then=`give me what I want`:else=`don't give me what I want`]]
            [ed. note: exside last edited this post 11 years, 5 months ago.]