Wrapper
#1
Posted 15 September 2004 - 07:01 PM
Snippet name: Wrapper
Author: pcwacht
Version: 1.0 (Final)
More info: View this snippet
Description:
This snippet can be used to 'wrap' pages or websites so they seem to be 'in your site'.
Please feel free to comment on this snippet, suggest improvements, or simply praise my work! ;)
[This is an automatically created message]
#4
Posted 17 September 2004 - 06:52 AM
The wrapper snippet can be used to show other webdocuments in an IFRAME in your content part so it will seem to be part of your website.
You could for instance show a gallery, forum, static pages or anything else this way.
You call the snippet with parameters:
- Variable list:
- $wurl = "http://www.etomite.com";
What would you like to show? Wich webpage must be wrapped
- $wname = "<b>Etomite</b>";
Name to show under the IFrame.
- $wshowname = "1";
Show the name? 1 yes, 0 no
- $wwidth = "100%";
- $wheight = "600";
Width and Height of the IFrame, width recommended 100% and height recommended 600 but it edpends on your pages.
- $wscroll = "auto";
Would you like to show scrollbars? auto, yes or no
- $wauto = "1";
auto resize 1 yes, 0 no, the wrapper will try to get maximum size
- $wframe = "1";
Show 1 or hide 0 the iframe borders
- $wlink = "1";
Would you like to show a direct link? 1 yes, 0 no
- $wwtext = "Click here";
Text for direct link
You can set defaults in the snippet, so you don't need to call the snippet with each variable.
That's basicly it.
Here are some examples on my testsite : http://pcwacht.mine....62/wrapper.html
Good luck,
John
#6
Posted 20 September 2004 - 01:30 PM
What are snippets?
and
How to write snippets
Those should give you a pretty good overview. More specific questions can then be addressed here in the forums.
#7 Guest_Bling_*
Posted 24 September 2004 - 06:18 PM
Quote
Seen at..
http://www.thinkblin...index.php?id=19
#8
Posted 24 September 2004 - 06:28 PM
#9 Guest_Bling_*
Posted 24 September 2004 - 07:50 PM
[[wrapper?wurl=http://blogger.thinkbling.com&wname=Blog]]
It's name and description are
Quote
#
# Wrapper - Etomite v0.6
#
# Adapted for Etomite 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://etomite.com&wname=Etomite] ]
#
# Variable list:
# $wurl = "http://etomite.com"; // What would you like to show?
# $wname = "<b>Etomite</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://etomite.com";
$dname = "<b>Etomite</b>";
$dshowname = "1";
$dwidth = "100%";
$dheight = "600";
$dscroll = "auto";
$dauto = "1";
$dframe = "1";
$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;
#10
Posted 24 September 2004 - 11:34 PM
UPDATE: This code works...
#
# Wrapper - Etomite v0.6
#
# Adapted for Etomite 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://etomite.com&wname=Etomite] ]
#
# Variable list:
# $wurl = "http://etomite.com"; // What would you like to show?
# $wname = "<b>Etomite</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://etomite.com";
$dname = "<b>Etomite</b>";
$dshowname = "1";
$dwidth = "100%";
$dheight = "600";
$dscroll = "auto";
$dauto = "1";
$dframe = "1";
$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;
#11
Posted 25 September 2004 - 03:13 PM
[This is an automatically created message]
Or at least so I tried
Still having problems using
\"in snippet library. It will turn into
"wich is not working
Get a copy at http://pcwacht.mine.nu/etomite62 for the time being.
Or use the code Rad has kindly repaired ;)
John
#13
Posted 26 September 2004 - 11:36 AM
Bling, on Sep 26 2004, 05:54 AM, said:
Should have something to do with the way IFrames work.
You call the IFrame with no information in it, so it could only fit to 100% in width of current tablecell. The heigth is determined by content wich it hasn't have yet.
At least so I think.
#14 Guest_Bling_*
Posted 27 September 2004 - 02:24 PM
pcwacht, on Sep 26 2004, 06:36 AM, said:
You call the IFrame with no information in it, so it could only fit to 100% in width of current tablecell. The heigth is determined by content wich it hasn't have yet.
At least so I think.
With pure HTML, you are correct. However the Mambo wrapper allows you to show iframes at a 100% height.

Sign In
Register
Help
MultiQuote