Etomite Community Forums: Wrapper - Etomite Community Forums

Jump to content

Read Me

This forum is posted in automatically when a snippet is added to the library, or updated. Please use the snippet topic to discuss that snippet.

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Wrapper

#1 User is offline   pcwacht 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 135
  • Joined: 10-August 04
  • Location:Netherlands
  • Interests:Erm... IT?

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

  • Group: Guests

Posted 16 September 2004 - 06:02 PM

Is there any additional documentation for this snippet?

#3 User is offline   luislacerda 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 87
  • Joined: 01-May 04
  • Location:Oporto, Portugal
  • Interests:Photography

Posted 16 September 2004 - 06:58 PM

Praise here.
Tkx :)
Luis

#4 User is offline   pcwacht 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 135
  • Joined: 10-August 04
  • Location:Netherlands
  • Interests:Erm... IT?

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

Good luck,
John

#5 Guest_Bling_*

  • Group: Guests

Posted 20 September 2004 - 12:56 PM

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

#6 User is offline   jaredc 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,193
  • Joined: 02-July 04
  • Location:Earth &gt; USA &gt; Ohio &gt; Columbus
  • Interests:Family, church (LDS), foosball, Boy Scouts.

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

  • Group: 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.thinkblin...index.php?id=19

#8 User is offline   Ralph 

  • Etomite Administrator
  • Icon
  • Group: Admin
  • Posts: 6,370
  • Joined: 01-July 04
  • Gender:Male
  • Location:Jamestown, NY USA
  • Interests:Computers, Camping, Hiking, Aviation

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

  • Group: 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 User is offline   Ralph 

  • Etomite Administrator
  • Icon
  • Group: Admin
  • Posts: 6,370
  • Joined: 01-July 04
  • Gender:Male
  • Location:Jamestown, NY USA
  • Interests:Computers, Camping, Hiking, Aviation

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 User is offline   pcwacht 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 135
  • Joined: 10-August 04
  • Location:Netherlands
  • Interests:Erm... IT?

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

  • Group: 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 User is offline   pcwacht 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 135
  • Joined: 10-August 04
  • Location:Netherlands
  • Interests:Erm... IT?

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

  • Group: 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 User is offline   pcwacht 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 135
  • Joined: 10-August 04
  • Location:Netherlands
  • Interests:Erm... IT?

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.

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users