Jump to content


Wrapper


76 replies to this topic

#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,746 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.


#36 Jelmer

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,173 posts

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

  • 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 Jelmer

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,173 posts

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

  • 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/clubs_comp/?action=team...TeamDescription

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

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

Edited by clubvibe, 15 August 2005 - 01:13 PM.


#40 Jelmer

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,173 posts

Posted 15 August 2005 - 02:40 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users