Wrapper
#17
Posted 07 November 2004 - 10:50 PM
# With most gratitude to Jason Murphy (Jason407) for making the Mambo original;)
#
# 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($wauto)) {$wauto = $dauto; }
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 = 'onload="javascript:iFrameHeight()" ';
$wrapped .= '<script type="text/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 type="text/javascript">';
$wrapped .= "function blockError(){return true;}";
$wrapped .= "window.onerror = blockError;";
$wrapped .= "</script>";
$wrapped .= '<iframe id="blockrandom" ';
$wrapped .= ''.$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>';
}
$wrapped .= "</div>";
return $wrapped;
#19
Posted 15 November 2004 - 05:32 AM
Is there something else that needs to be configured before it will wrap the external content? I am using the snippet 'straight out of the box' so to speak. I'm using version 6 final on Apache. and am getting the same output on both firefox 0.8 and IE 5.?
here is the code inserted into the page
Quote
and here is the link to the page in question
http://66.197.162.85...index.php?id=69
#22
Posted 16 November 2004 - 08:51 PM
[ [Wrapper?url=www.speedstreet.org/forums/showthread.php?id=369] ]
Then it kicks me out to the main page. Am I to assume that it is because it refuses to parse anything beyond the question mark?
Is there a workaround?
#24
Posted 17 November 2004 - 06:21 PM
Will give
url = www.speedstreet.org/forums/showthread.php
AND
id = 369
as variables to the snippet
while you need to pass the whole string
www.speedstreet.org/forums/showthread.php?id=369
to the variable url to the snippet
Maybe it works when you try
Wrapper?url='www.speedstreet.org/forums/showthread.php?id=369'
or simular
Wrapper?url="www.speedstreet.org/forums/showthread.php?id=369"
Dunnoh.
Good luck
John
#25
Posted 21 June 2005 - 03:21 PM
this is a really nice snippet and it works pretty well. My question: I use the wrapper to integrate links from my account at http://www.spurl.net/. Now I would like to open the link in a new browser window/tab. For now, I made a copy of my template with basetarget-blank in the head, but that would apply to the navigation, too...
Any ideas?
#26
Posted 11 August 2005 - 12:39 AM
Unfortunately, you must create a new page with the code:
[[Wrapper?wurl=...]] on it for EACH separate page you want pulled in.
What I'd like to do is have the content wrapped on the fly so when I click the link, it pulls the content into the iframe & presents it as a new page:
<a href="[[Wrapper...]]]">
In other words, return a url to the just-wrapped page without me having to create that url beforehand.
What if you have a page containing: [[Wrapper?wurl=<?php echo $myurl;?>]], and update $myurl from another snippet?
Any ideas on how to make this work?
#27
Posted 11 August 2005 - 11:04 PM
OK wait, no you can't use the php open tags and echo.
http://www.etomite.c...ets/Usage?v=7g6
You can have snippets call other snippets. you just send the snippet call in the output.
//do some stuff here $html = "[[Wrapper?wurl=" . $myurl . "]]"; return $html;
This post has been edited by mrruben5: 11 August 2005 - 11:10 PM
#30
Posted 11 August 2005 - 11:40 PM
See my fancy scripts here: <a href=[[Wrapit?myurl=assets/portfolio/QuestionnaireServlet.html]]>My Scripts</a>
Where QuestionnaireServlet.html is a plain old html page containing the stuff I want wrapped.
The Wrapit snippet looks as you recommended:
//do some stuff here $html = "[[Wrapper?wurl=" . $myurl . "]]"; return $html;
This gets me a link containing:
http://mysite.com/%3.../a%3E%3C/div%3E
[the contents of the Wrapper snippet]. Of course, this link doesn't work (Bad request).
I think I'm missing a concept here somewhere...
This post has been edited by mark301: 11 August 2005 - 11:48 PM

Sign In
Register
Help
MultiQuote