Jump to content


Wrapper


  • You cannot reply to this topic
76 replies to this topic

#16 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 04 November 2004 - 08:57 PM

I have updated this snippet in the Snippet Library!

[This is an automatically created message]

#17 Lefteris_D

    Etomite Forum Newbie

  • Member
  • 19 posts

Posted 07 November 2004 - 10:50 PM

I converted the code in this snippet to xhtml1.0 transisional but I still get a couple of errors inside the javascript. Any ideas on what might be wrong?

# 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;


#18 justme

    Etomite Forum Newbie

  • Member
  • 15 posts

Posted 15 November 2004 - 05:26 AM

[[crazy posting gremlins]]

#19 justme

    Etomite Forum Newbie

  • Member
  • 15 posts

Posted 15 November 2004 - 05:32 AM

Hey there I am attempting to get the wrapper to work. I loaded the snippet. Created a page with the example link to make sure it is working before configuring further. Unfortunately while I'm not getting any errors, what is happening is that the page displays in the browser with the snippet code displayed intact.

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

[[wrapper?wurl=http://www.etomite.com&amp;wname=Etomite]]

and here is the link to the page in question

http://66.197.162.85/~entwoodn/index.php?id=69

#20 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 15 November 2004 - 10:04 PM

justme, on Nov 15 2004, 07:26 AM, said:

[[crazy posting gremlins]]

Check your snippet name
Make sure lcase and ucase matches

#21 justme

    Etomite Forum Newbie

  • Member
  • 15 posts

Posted 15 November 2004 - 11:21 PM

pcwacht, on Nov 15 2004, 05:04 PM, said:

Check your snippet name
Make sure lcase and ucase matches


Don't I just hate/love when it's something so simple. Kinda like 'check the plug'.

thanx a lot. :rolleyes:

#22 SpeedStreet

    Etomite Forum Fan

  • Member
  • Pip
  • 55 posts

Posted 16 November 2004 - 08:51 PM

I'm having difficulty attempting to pass dynamic URLs through the wrapper. If I use:

[ [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?

#23 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 16 November 2004 - 11:41 PM

:?:

Quote

  refuses to parse anything beyond the question mark?
I don't know about that part, but I had trouble if the "http://" was not added to the snippet call......

#24 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 17 November 2004 - 06:21 PM

Wrapper?url=www.speedstreet.org/forums/showthread.php?id=369

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 Alex_Leipzig

    Etomite Forum Newbie

  • Member
  • 6 posts

Posted 21 June 2005 - 03:21 PM

Hi there,

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 mark301

    Etomite Forum Newbie

  • Member
  • 34 posts

Posted 11 August 2005 - 12:39 AM

Nice work!

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 mrruben5

    Likes Etomite Forums!

  • Member
  • PipPip
  • 255 posts

Posted 11 August 2005 - 11:04 PM

Make a weblink instead of an url :)

OK wait, no you can't use the php open tags and echo.

http://www.etomite.com/wiki/EtomiteDocumen...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;

Edited by mrruben5, 11 August 2005 - 11:10 PM.


#28 mark301

    Etomite Forum Newbie

  • Member
  • 34 posts

Posted 11 August 2005 - 11:08 PM

Quote

Make a weblink instead of an url

I feel really dumb :huh: : can explain, please?

#29 mrruben5

    Likes Etomite Forums!

  • Member
  • PipPip
  • 255 posts

Posted 11 August 2005 - 11:12 PM

A weblink can be created the same way documents are created. The only difference is that it doesn't have content, it has an url.

Look up :)

Edited by mrruben5, 11 August 2005 - 11:12 PM.


#30 mark301

    Etomite Forum Newbie

  • Member
  • 34 posts

Posted 11 August 2005 - 11:40 PM

So I've got a document like this:
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/%3Cscript%20language=.../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...

Edited by mark301, 11 August 2005 - 11:48 PM.


#31 Dean

    Loves Etomite Forums!

  • Admin
  • 4,744 posts
  • Gender:Male

Posted 12 August 2005 - 06:18 AM

I think you are missing the concept of Snippets

What you need to do is go into your manager, and then to the Resources section

Choose add a New Snippet.

Paste the Snippet code into the big white box, and give it a name at the top (Wrapper)

Then edit the document you want the wrapper snippet on, and type in the editor [[Wrapper?wurl=http://www.mylinkgoeshere.com]]

And that should be it :D

#32 mark301

    Etomite Forum Newbie

  • Member
  • 34 posts

Posted 12 August 2005 - 01:40 PM

Let me clarify what I'm after: I've got quite a few documents I'd like wrapped, and I don't want to create another page for each just containing "[[Wrapper?...]]". What the existing Wrapper code does is return the contents of the Wrapper snippet - i.e. the html for an iframe wrapping my pre-existing content

I'd like Wrapper to use a generic wrapping page template and return a url to that template wrapping my document, like this:

<a href="[[Wrapper?wurl=http://mypage.com\1.htm]]"></a> should return me something like this<a href="http://mypage.com\wrapper.htm?url=1.htm"></a>

<a href="[[Wrapper?wurl=http://mypage.com\2.htm]]"></a> should return me something like this<a href="http://mypage.com\wrapper.htm?url=2.htm"></a>

If I could use PHP in a page, the wrapping template would be something like this:
[[Wrapper?wurl=<?php $_GET['url']?>]]


#33 Jelmer

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,173 posts

Posted 12 August 2005 - 04:32 PM

I'd say you'd have to have:
- A page with only [[Wrapper]] on it (e.g. wrapper.html)
- A slightly modified Wrapper snippet that gets it's $wurl like this:
$wurl = isset($wurl) ? $wurl : "http://www.mydefaultsite.com";
- Links to the page like this: http://www.yoursite.com/wrapper.html?wurl=...rapthispage.com

Didn't test it, but it should work.

Edit: Hmm with register_globals set to "off" this won't work of course. You could use this PHP instead:
$wurl = $_GET['wurl'];
if ($wurl == "") { $wurl = "http://www.mydefaultsite.com"; }

Please note that this code doesn't check for potential security hazards. It'll include allmost everything into your site...

Edited by Jelmer, 12 August 2005 - 05:37 PM.


#34 mark301

    Etomite Forum Newbie

  • Member
  • 34 posts

Posted 12 August 2005 - 06:45 PM

Bingo!

Jelmer, I thank you...

...I think :) That is indeed quite a security hole, dang!

#35 Guest_clubvibe_*

  • Guests

Posted 15 August 2005 - 12:17 PM

i'd like to implant jelmers mod into the wrapper code. but i don't fully understand where to put it.

Here is the code:

# 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 = "0";                       // show the name? 1 yes, 0 no 
#  $wwidth    = "700";                    // 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     = "0";                       // 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 = "0"; 
$dwidth    = "710"; 
$dheight   = "600"; 
$dscroll   = "auto"; 
$dauto     = "0"; 
$dframe    = "0"; 
$dlink     = "0"; 
$dwtext    = ""; 

// 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                                                   ********SOMEWHERE HERE ????***********
                                                                                      ********SOMEWHERE HERE ????***********
if (!(eregi("http://", $wurl) || (eregi("https://",$wurl)))) {    ********SOMEWHERE HERE ????***********
    $wurl = "http://".$wurl;                                                ********SOMEWHERE HERE ????***********
} 
// 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;

now where do i have to put his:

$wurl = $_GET['wurl'];
if ($wurl == "") { $wurl = "http://www.mydefaultsite.com"; }

pardon my noob skills...

i'll explain why i want to use it:

i would like to use this url= http://www.knvb.nl/clubs_comp/?action=team...amDescription=9

with the wrapper. but it won't allow me to. As far as I understood this little Jelmer hack should do the trick, isn't it?

Edited by clubvibe, 15 August 2005 - 12:21 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users