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
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Wrapper

#16 User is offline   pcwacht 

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

Posted 04 November 2004 - 08:57 PM

I have updated this snippet in the Snippet Library!

[This is an automatically created message]

#17 User is offline   Lefteris_D 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 19
  • Joined: 19-August 04
  • Location:Athens, Greece
  • Interests:You dont really want to know ;)

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

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 15
  • Joined: 15-November 04

Posted 15 November 2004 - 05:26 AM

[[crazy posting gremlins]]

#19 User is offline   justme 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 15
  • Joined: 15-November 04

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...index.php?id=69

#20 User is offline   pcwacht 

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

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

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 15
  • Joined: 15-November 04

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

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 55
  • Joined: 02-August 04
  • Location:St Paul, MN

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

  • Likes Etomite Forums!
  • PipPip
  • Group: Member
  • Posts: 319
  • Joined: 02-May 04

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

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

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

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 6
  • Joined: 15-June 05

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

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 34
  • Joined: 15-July 05

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

  • Likes Etomite Forums!
  • PipPip
  • Group: Member
  • Posts: 255
  • Joined: 09-June 05
  • Location:Leusden, The Netherlands

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.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


#28 User is offline   mark301 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 34
  • Joined: 15-July 05

Posted 11 August 2005 - 11:08 PM

Quote

Make a weblink instead of an url


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

#29 User is offline   mrruben5 

  • Likes Etomite Forums!
  • PipPip
  • Group: Member
  • Posts: 255
  • Joined: 09-June 05
  • Location:Leusden, The Netherlands

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 :)

This post has been edited by mrruben5: 11 August 2005 - 11:12 PM


#30 User is offline   mark301 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 34
  • Joined: 15-July 05

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/%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


  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 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