We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 70
    • 23 Posts
    re: problem with wrapper snippet

    My website is at www.club-minder.com
    MODx 0.9.2.1 (rev 1005)

    I am trying to use the wrapper snippet to embed a calendar program I am using.
    Within the ModX page I am simply using [[wrapper]]
    The calendar program is located /calendar.

    If I manually type http://www.club-minder.com/calendar/ the calendar populates without Modx framework AND the calendar events are viewable.

    If I traverse to the calendar from picking the calendar tab from navbar, calendar events do not show.
    http://www.club-minder.com/index.php?id=12

    What do I need to do so that the events are correctly populated within my modx page huh

    Thanks...

    btw...the current calendar view is very simplistic. Haven’t spent much time modifiying it.

    snippet code from modx download section....
    #
    # 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://www.munyak.com/calendar/";
    $dname     = "<b>Calendar</b>";
    $dshowname = "1";
    $dwidth    = "100%";
    $dheight   = "600";
    $dscroll   = "auto";
    $dauto     = "1";
    $dframe    = "0";
    $dlink     = "1";
    $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.<br>You may want to Upgrade your Browser.<br><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 .= "<br>";
    // need to show link?
    if ($wlink == "1") {
      $wrapped .= "<a href='".$wurl."' target='_blank'>[".$wwtext."]</a></div>";
    }
    return $wrapped;
    
      I am but a dwarf in a land of giants... with propellars, calculators, bluetooth and beepers smiley
      • 8164
      • 51 Posts
      I use EasyPHP Calendar on a couple of sites and they seem to work well without being displayed in a wrapper. (example: http://www.centennialplastics.com/trade-shows.html )

      I make two Snippets to hold the page display php code:

      SNIPPET calendarMonth:
      require("calendar/calendar.php");

      and SNIPPET calendarList:
      $LIST=1;
      $listEvents = 10;
      $listWeeks = 52;
      $noOld = 1;
      $DF = "D - M d";
      $template="monthly.php";
      require ("calendar/calendar.php");

      The css for EasyPHP Calendar doesn’t get picked up for some reason, so the category colors don’t show...but functionally, the calendar displays are perfect.

      Maybe that will work better for you than the wrapper approach.

      Duane
        • 7923
        • 4,213 Posts
        The url in your wrapper snippet configuration points to http://www.munyak.com/calendar/ but the url to the working calendar in your post points to http://www.club-minder.com/calendar/


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 70
          • 23 Posts
          Doze...I had a major brain fart. Thanks for pointing that out to me.

          Duane...Haven’t tried yet, but I see your point...Thanks

          Don
            I am but a dwarf in a land of giants... with propellars, calculators, bluetooth and beepers smiley