Jump to content


Wrapper


76 replies to this topic

#1 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 15 September 2004 - 07:01 PM

I have added a new snippet to the Snippet Library!

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]

#2 Guest_Bling_*

  • Guests

Posted 16 September 2004 - 06:02 PM

Is there any additional documentation for this snippet?

#3 luislacerda

    Etomite Forum Fan

  • Member
  • Pip
  • 87 posts

Posted 16 September 2004 - 06:58 PM

Praise here.
Tkx :)
Luis

#4 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 17 September 2004 - 06:52 AM

Documentation other then provided allready.

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.nu/etomite62/wrapper.html

Good luck,
John

#5 Guest_Bling_*

  • Guests

Posted 20 September 2004 - 12:56 PM

How do you like creating snippets in ETOMite compared to creating modules in Mambo?

#6 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 20 September 2004 - 01:30 PM

Please read:

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_*

  • Guests

Posted 24 September 2004 - 06:18 PM

Anybody know what I am doing wrong when I get the following?

Quote

Parse error: parse error in /home/rescue00/domains/thinkbling.com/public_html/e6/index.php(554) : eval()'d code on line 57

Seen at..
http://www.thinkbling.com/e6/index.php?id=19

#8 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 24 September 2004 - 06:28 PM

We can't be of any help if we don't know what code you are attempting to execute for the Blog menu option... <_< Is this menu option referring to one of the standard snippets that came in Etomite, a snippet you have written, or a snippet out of the Snippet Library here in the forums...:?: Give us more details and we can be of more help... B) The error code itself doesn't provide enough information to make an accurate assessment of your problem... :(

#9 Guest_Bling_*

  • Guests

Posted 24 September 2004 - 07:50 PM

It's to the wrapper snippet. My only content for my blog page is...

[[wrapper?wurl=http://blogger.thinkbling.com&wname=Blog]]

It's name and description are

Quote

wrapper
(all lower case). The snippet is as follows.

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

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 24 September 2004 - 11:34 PM

Ok... After looking at your code, the problem is obvious... You cannot use double quotes around variable assignments within a double quoted string... In line 57, as well as several others, you have code like $wrapped .= "<script language="JavaScript">"; whcih needs to be changed to either something like $wrapped .= "<script language=\"JavaScript\">"; OR $wrapped .= "<script language='JavaScript'>";... I haven't fully corrected and tested this code for functionality, but will ASAP... Try making those changes and see if your snippet works... B)

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 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 25 September 2004 - 03:13 PM

I have updated this snippet in the Snippet Library!

[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

#12 Guest_Bling_*

  • Guests

Posted 26 September 2004 - 03:54 AM

How come when I supply a height of 100% for the wrapper? It doesn't end up showing.

#13 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 26 September 2004 - 11:36 AM

Bling, on Sep 26 2004, 05:54 AM, said:

How come when I supply a height of 100% for the wrapper?  It doesn't end up showing.

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_*

  • Guests

Posted 27 September 2004 - 02:24 PM

pcwacht, on Sep 26 2004, 06:36 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.
With pure HTML, you are correct. However the Mambo wrapper allows you to show iframes at a 100% height.

#15 pcwacht

    Etomite Forum Fan

  • Member
  • Pip
  • 135 posts

Posted 29 September 2004 - 01:25 PM

It is the same, kinda

Where mambo components output the content during the page is made, etomite snippets output the content into a variable. The variable is added to the content on the right spot.

Kinda diff.

#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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users