We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12502
    • 1 Posts
    Hello everybody!

    I wondered if there is a snipped or module like a wrapper that lets me include external pages into one of my modx pages?
    Would be very cool!

    Greetings
    Huwy
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There are a few options:
      http://modxcms.com/forums/index.php/topic,2903.msg20450.html#msg20450
      And using a TV with a viewport widget output:
      http://modxcms.com/view-port-widget.html
        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
        • 29076
        • 615 Posts
        I use this snippet-code (sorry, don’t remember where I found it), where my modifications is marked with red:

        <?php
        #
        # Wrapper
        #
        # Adapted by: John Maats - john-at-pn.nl
        #
        # Usage:
        # Set defaults and use [ [Wrapper] ] inside your content
        #
        # or call it with variables (example):
        # [ [wrapper?wurl=http://www.modxcms.com&wname=Mod-X] ]
        #
        # Variable list:
        # $wurl = "http://www.modxcms.com"; // What would you like to show?
        # $wname = "<b>Mod-X</b>"; // Name to show
        # $wshowname = "1"; // show the name? 1 yes, 0 no
        # $wwidth = "100%"; // width , recommended 100%
        # $wheight = "600"; // height, recommended 600
        # $wscroll = "auto"; // auto, yes or no scrollbars visible
        # $wauto = "1"; // auto resize 1 yes, 0 no
        # $wframe = "1"; // show 1, hide 0 iframe borders
        # $wlink = "1"; // show direct link 1 yes, 0 no
        # $wwtext = "Click here"; // Text for direct link
        #
        # If variable is not set, snippet will choose following defaults

        // your defaults, oh Master!
        $durl = "http://met.no/kyst_og_hav/index.html";
        $dname = "<b>Mod-X</b>";
        $dshowname = "0";
        $dwidth = "100%";
        $dheight = "6500";

        $dscroll = "auto";
        $dauto = "1";
        $dframe = "0";
        $dlink = "0";
        $dwtext = "Click here to open in new window!";

        // No need to change stuff underneath...
        // set defaults...
        $wrapped ="";
        if (!isset($wurl)) {$wurl = $durl; }
        if (!isset($wheight)) {$wheight = $dheight; }
        if (!isset($wwidth)) {$wwidth = $dwidth; }
        if (!isset($wscroll)) {$wscroll = $dscroll; }
        if (!isset($wframe)) {$wframe = $dframe; }
        if (!isset($wname)) {$wname = $dname; }
        if (!isset($wshowname)) {$wshowname = $dshowname; }
        if (!isset($wlink)) {$wlink = $dlink; }
        if (!isset($wwtext)) {$wwtext = $dwtext; }
        // check for http:// in url
        if (!(eregi("http://", $wurl) || (eregi("https://",$wurl)))) {
        $wurl = "http://".$wurl;
        }
        // need resize?
        if ($wauto == "1"){
        $xload = "iFrameHeight()";
        $wrapped .= "<script language=’JavaScript’>";
        $wrapped .= "function iFrameHeight() {";
        $wrapped .= " var h = 0;";
        $wrapped .= " if(document.getElementById && !(document.all))";
        $wrapped .= " {";
        $wrapped .= " h = document.getElementById(’blockrandom’).contentDocument.height;";
        $wrapped .= " document.getElementById(’blockrandom’).style.height = h + 60 + ’px’;";
        $wrapped .= " }";
        $wrapped .= " else if(document.all)";
        $wrapped .= " {";
        $wrapped .= " h = document.frames(’blockrandom’).document.body.scrollHeight;";
        $wrapped .= " document.all.blockrandom.style.height = h + 20 + ’px’;";
        $wrapped .= " }";
        $wrapped .= "}";
        $wrapped .= "</script>";
        } else {
        $xload = "";
        }
        $wrapped .= "<script language=’JavaScript’>";
        $wrapped .= "function blockError(){return true;}";
        $wrapped .= "window.onerror = blockError;";
        $wrapped .= "</script>";
        $wrapped .= "<IFRAME id=’blockrandom’";
        $wrapped .= "onLoad=’".$xload."’";
        $wrapped .= "SRC=’".$wurl."’";
        $wrapped .= "width=’".$wwidth."’ height=’".$wheight."’ align=top scrolling=’".$wscroll."’ frameborder=’".$wframe."’>Sorry, your Browser does NOT SUPPORT IFRAME.
        You may want to Upgrade your Browser.
        <a href=’".$wurl."’ target=’_blank’>Click Here to see the page that was supposed to load.</a>".$wurl."</IFRAME>";
        $wrapped .= "<div align=’center’>";

        // need to show name?
        if ($wshowname == "1") {
        $wrapped .= $wname;
        }
        $wrapped .= "
        ";
        // need to show link?
        if ($wlink == "1") {
        $wrapped .= "<a href=’".$wurl."’ target=’_blank’>[".$wwtext."]</a></div>";
        }
        return $wrapped;
        ?>

        Hope it can help in som way. You can see my example here (not finished, under construction, thats why the narrow column).
          I think, thererfor I am! But what I am, and why...?