We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13292
    • 3 Posts
    Took me some time, but this is how I got it to work:

    Say you want to load www.yourdomain.com/pagex.php into an iframe, and you want it to autoresize.

    A. Create a new Snippet, call it AutoSizeiFrame and put the provided php-code into the snipped code box. Save it tongue. Remember to change

    //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
    //Separate each ID with a comma. Examples: [’myframe1’, ’myframe2’] or [’myframe’] or [] for none:
    var iframeids=[" . $iframeids . "]

    this part in the code to suit your needs. eg: var iframeids=[’myframe1’, ’myframe2’, ’myframe3’]

    B. Create a new Templet Variable, give it a name, eg ’mynewframe’. As input type choose URL, In the dropdownbox Widget choose View Port, ID/Name: myframe1, at least choose autosize: yes and stretch to fit: yes. In the part template access check the template you are using. Save it tongue.

    c. Create a new Document, use [[AutoSizeiFrame? &iframeids=myframe1]] [*mynewframe*] to call both the created autoresizeiframe Snippet (A) and the created frame (B) in the document. Fill in the URL of the page you want to load (www.yourdomain.com/pagex.php) in the section Template Variables, where now mynewframe is showing up. After choosing http:// ofc. Save it tongue.

    Goodluck



      • 25551 ☆ A M B ☆
      • 1,231 Posts
      I know this is an old thread but i’m interested in using this... I want to integrate my forum on my modx website and the only was i can think of doing it is iframes... I’ve got the iframe working, it’s just not resizing automatically. Has anyone got this working or have another option for integrating a forum in a modx based site?
        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
        AugmentBLU - MODX Partner

        BLUcart - MODX Revolution E-Commerce & Shopping Cart
        • 13292
        • 3 Posts
        If you follow my instructions, posted just one above yours, you should be able to get it to work. Load the homepage of the forum in the iframe. If you use SMF there is also a bridge-mod that allows you to bridge MODx and SMF login.

        On a side note, I do have a bug with IE, which keeps an open space between the upper border of the frame and the content.
          • 25551 ☆ A M B ☆
          • 1,231 Posts
          I did follow the instructions and the iframe will not resize automatically... scroll bars appear. I can understand why the horizontal bar appears as the content box is not very big but it should extend further than it is. I’ll recheck tomorrow. Thanks
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 3743
            • 42 Posts
            Does not work in opera 9.24
              • 5529
              • 70 Posts
              Anyone had any luck getting this thing to work with an external URL? I’m having all kinds of trouble...
                • 32494
                • 14 Posts
                I’ve been struggling with this as well. The frame shows, but the height does not change at all. Seems like the AutoSizeiFrame has no effect on it.

                My settings:
                Made this change to the snippet: var iframeids=[’myframe1’, ’myframe2’, ’myframe3’]
                Set this as ID in the TV: myframe1
                And used this code on the page: [[AutoSizeiFrame? &iframeids=myframe1]] [*ViewportWidget*]

                The result is here. As you can see it does not take the size of the page. (It is on the same site.)
                  • 32494
                  • 14 Posts
                  Now it seems ot be working again. Not sure what I did wrong. Will keep you postes.
                    • 32494
                    • 14 Posts
                    I found the problem, but not a solution.

                    When one is logged into manager, the AutoSizeiFrame works fine. When one is not logged in (like most clients would be) the page is displayed without the frame expanding downwards.

                    What can cause this and how do I solve it?
                      • 32494
                      • 14 Posts
                      I still experience that code works sometimes, and other times not. anyone ezperiencing the same. Any solutions?