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

Wrapper

#31 User is offline   DeanC 

  • Etomite Administrator
  • Icon
  • Group: Admin
  • Posts: 4,702
  • Joined: 08-June 04
  • Gender:Male
  • Location:United Kingdom

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

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

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

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

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

This post has been edited by Jelmer: 12 August 2005 - 05:37 PM


#34 User is offline   mark301 

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

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

  • Group: 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/c...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?

This post has been edited by clubvibe: 15 August 2005 - 12:21 PM


#36 User is offline   Jelmer 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

Posted 15 August 2005 - 12:31 PM

I'd put it right above these lines:
// No need to change stuff underneath... 
// set defaults... 
$wrapped ="";


#37 Guest_clubvibe_*

  • Group: Guests

Posted 15 August 2005 - 12:48 PM

i did as you said,

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

// No need to change stuff underneath... 
// set defaults...


set it as above every wrapper element turns in to the default (google) page.

so

[[wrapper?wurl=http://www.knvb.nl/clubs_comp/?action=teamDetails&ClubName=Zoetermeer,%20FC&NotationDescription=Mannen%20beker%20reserve%20zondag%20poule&LevelDescription=Groep%207&CompetitionType=B1600&ClassLevel=27&RegionCode=KNVB-DISTRICT-WEST2&Pool=10&TeamDescription&wname=FCZ 9 Uitslagen]]


and also
[[wrapper?wurl=http://www.zoetermeer9.nl/fczoetermeer/statistieken.php&wname=Statistieken]]


become google.com

(it doens't matter if i set the url between " ")

become google

#38 User is offline   Jelmer 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

Posted 15 August 2005 - 01:01 PM

Yes, if you're planning to use only a few documents in the wrapper you can just use the normal Wrapper snippet, skip the extra lines. Then put [[Wrapper?wurl=blabla]] in your page and it should work.

This mod is used to make links to a single file with the URL to wrap included. I think you don't need it...

#39 Guest_clubvibe_*

  • Group: Guests

Posted 15 August 2005 - 01:12 PM

without your mod this code works:

[[wrapper?wurl=http://www.zoetermeer9.nl/fczoetermeer/statistieken.php&wname=Statistieken]]

but this one won't:

[[wrapper?wurl=http://www.knvb.nl/clubs_comp/?action=teamDetails&ClubName=Zoetermeer,%20FC&NotationDescription=Mannen%20beker%20reserve%20zondag%20poule&LevelDescription=Groep%207&CompetitionType=B1600&ClassLevel=27&RegionCode=KNVB-DISTRICT-WEST2&Pool=10&TeamDescription&wname=FCZ 9 Uitslagen]]

page not found is the result (in a browser this url works just fine)

I tought your code was the answer to this problem.

and in a certain way it is. i experimented a bit and if i change the deafult page (i had google remember) in to this url : http://www.knvb.nl/c...TeamDescription

the wapper works.... but still all my pages ar this default page.

(check at http://www.zoetermeer9.nl/site)

This post has been edited by clubvibe: 15 August 2005 - 01:13 PM


#40 User is offline   Jelmer 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

Posted 15 August 2005 - 02:40 PM

ok i think you should use the original snippet and set $durl to your KNVB page.

#41 Guest_clubvibe_*

  • Group: Guests

Posted 15 August 2005 - 08:38 PM

ok... but if I do so I can only use 1 page like the KNVB site (the default one).
----let me check----

As i tought everything work fine, but i can only use one KNVB site..

this is very weird... if I set the knvb site to the default it loads, but if I set it as a variable it won't work :S

Isn't there any solution?

I figured out why wrapper fails.. in the url: www.knvb.nl/clubs_comp/?action=teamDetails&ClubName=Zoetermeer,%20FC&NotationDescription=Mannen%20beker%20reserve%20zondag%20poule&LevelDescription=Groep%207&CompetitionType=B1600&ClassLevel=27&RegionCode=KNVB-DISTRICT-WEST2&Pool=10&TeamDescription

wrapper tries to read the questionmark (for more variables) isn't there anywhy to get round the questionmark? like a code that ignores the questionmark in the wurl? or only apply to 1 question mark (the first one) in the whole wrapper-request?

This post has been edited by clubvibe: 15 August 2005 - 09:00 PM


#42 User is offline   Jelmer 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

Posted 15 August 2005 - 09:08 PM

It won't work as a variable because the URL is a dynamic URL itself I think. There's no way you can pass this URL along to a script.

Anyone's :2c: ?

#43 Guest_clubvibe_*

  • Group: Guests

Posted 15 August 2005 - 09:16 PM

i kind a solved it by making an iframe manualy. without wrapper that is. Works just fine... i think i just use this till wrapper has a 'support- dynamic-url-feature'.

just for the record, the manual code:
<script language="Javascript">
function blockError(){return true;}
window.onerror = blockError; 
</script><iframe align="top" src="http://www.knvb.nl/clubs_comp/?action=teamDetails&ClubName=Zoetermeer,%20FC&NotationDescription=Mannen%20beker%20reserve%20zondag%20poule&LevelDescription=Groep%207&CompetitionType=B1600&ClassLevel=27&RegionCode=KNVB-DISTRICT-WEST2&Pool=10&TeamDescription" frameborder="no" width="600" height="600" />

This post has been edited by clubvibe: 15 August 2005 - 09:19 PM


#44 User is offline   Jelmer 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

Posted 15 August 2005 - 10:42 PM

Ok now for something completely different.

Since my site is almost finished I'm currently trying to make it XHTML1.1 compliant. I'll all work out, but the Wrapper snippet is a nightmare.

One of the things is dat it doesn't recognize the <iframe > tag nor any of it's attributes src, id etc etc. What's wrong with this code?

If anyone has made the entire snippet XHTML1.1 compliant I'd love to have it.

Regards.

Edit: Never mind, I threw out everything I didn't need, validates now...

This post has been edited by Jelmer: 15 August 2005 - 10:51 PM


#45 User is offline   mark301 

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

Posted 16 August 2005 - 01:46 AM

Just FYI, instead of <iframe>, XHTML 1.1 uses <object...>, just be sure to set the content type to "text/html". Look up the syntax for how to do it, it works well, though, in IE & FF. I just finished moving my site to XHTML 1.1 & updating all the snippets I use.

<object type="text/html" data="pagetobeiframed.htm">Sorry, your browser does not support Object elements.  Please use the link above to open it in a separate window</object>


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