Wrapper

Version 2.4 beta 1 (27th April 2009)

A wrapper is just an iframe. This wrapper plugin enables you to embed external and internal web sites like a forum, galleries etc. into a CMSimple web page. Using the wrapper will not change menu handling and the structure of a CMSimple page.

This wrapper comes with three functions, the normal wrapping and two auto-wrapping functions.

(a) The normal wrapping function is thought to embed websites hosted under external domains.

(b)+( c) The auto-wrapping functions allow a flexible height of an iframe. No vertical scrollbar will enoy you. However, these functions are able to embed only such websites which are hosted under your own domain. Websites of external domains cannot be embedded by these functions!!!

The auto-wrapping functions were realized by (b) using the IFrame SSI script II of Dynamic Drive and as altenative ( c) the more recent script written by John Davenport Scheuer and publlished in the forum of Dynamic Drive (Sorry, the original code of this iframe version has been removed by Dynamic Drive. The reason is not clear to me, since the code works well in my hands and seems to have some advantages over the older one. Till). Which one of the two works better under certain conditions has to be tested.

What does autowrapper do?
This script adjusts the iFrame while the user interacts with the page inside of the iFrame. For example: If a user clicks through a shop located inside autowrapper's iFrame, usually the page of the shop shrinks or expands according to the amount of products listed. Autowrapper has the ability to adjust the iFrame's height while the user is interacting with the shop.

Download page
Direct Download

1. Installation

After unzipping the compressed plugin file you copy it into the “plugins” subfolder as any other plugin as well. While in administration only two buttons will appear: “plugin-stylesheet” and “plugin-help”. In “plugin-stylesheet” you can change appearence and dimensions of the wrapper by using standard CSS. The button “plugin-help” will just call-up this help page.

In order to embed an external page you use a CMSimple script in the following format:

(a) In case of websites hosted under external or own domains:

#CMSimple $output. = wrap($Url, $width, $height, $scrolling, $allowtransparency, $gettxt, $errtxt);#

or

(b) In case of websites hosted only under an own domain:

#CMSimple $output. = autowrap($Url, $width, $height, $scrolling, $allowtransparency, $gettxt, $errtxt);#

or

( c) New: As alternative for websites hosted only under an own domain:

#CMSimple $output. = autowrap2($Url, $width, $height, $scrolling, $allowtransparency, $gettxt, $errtxt);#

Instead of:
$Url - you use an internet address.
$width - you add the width of the iframe (in px or %).
$height - you add the height of the iframe (in px).
$scrolling - you define scrollbars or exclude them (yes|no|auto).
$allowtransparency - you determine the Microsoft proprietary feature attribute of transparency (true|false), which is only important for IE6. All other browsers show background transparency by default.
$gettxt - you add the text which should be shown while the external page is loading. Instead of text also images can be called up by adding their html address.
$errtxt - you add the text which should be shown, if the page cannot be found.

To embed this wiki, for example, use the following code:

#CMSimple $output.= wrap("http://cmsimplewiki.com/", "100%", "500", "auto", "true","Site is loading", "Page cannot be found.");#

To embed the Quick.Cart shop, for example, use the following code:

#CMSimple $output.= autowrap("./shop/index.php", "100%", "500", "auto", "true", "Site is loading", "Page cannot be found.");#

In case of autoWrapper you have to define height and scrolling as well, since autoWrapper - which is a javascript - is able to also run in a non-script area. So, you should test, how the autowrapper works, if javascript has been inactivated.

You must not omit any of the attributes in the function. If you do so, the script may not run properly! If you don't need one of the attributes, just use empty quotations marks - ie: #CMSimple $output.=wrap(“http://cmsimplewiki.com/”, “100%”, “500”, “auto”, ””, “Site is loading”, “Page cannot be found.”);#

Of course, you can run wrapper and/or autowrapper on more than just one CMSimple page - but only one wrapper per page.

Suggestions

a. Image instead of Text
If you want to show an image instead of text during loading time, you may say:

#CMSimple $output.= wrap("http://cmsimplewiki.com/", "100%", "500", "auto","true", "<img src='plugins/wrapper/images/loading.gif'> ", "Page cannot be found");#

An image file called “loading.gif” can be found in wrapper's subdirectory ”/images”.

When you are looking for some nice Ajax like preloader images, you could customize some here: http://www.ajaxload.info/ http://preloaders.net/en/3d

b. Vertical Scrollbar in Autowrapper
Sometimes autoWrapper seems to receive wrong values of the Firefox iFrame window. In that case a scrollbar will be shown, even though autoWrapper is in use. We can get rid of this scrollbar by finetuning. In line 71 of the index.php file of the wrapper plugin it says:

$hjs.= "var FFextraHeight=getFFVersion>=0.1? 16 : 0 \n";

If the “0” is exchanged by a higher value, the height of the iFrame window in Firefox is increased of about the same value of pixels.

$hjs.= "var FFextraHeight=getFFVersion>=0.1? 16 : 50 \n";

would increase the FF iFrame window's height of 50 pixels. The scrollbar will disappear. These 50 pixels will be used in additional calculations of iframe heights, which would follow the initial page.

c. Horizontal Scrollbar in Autowrapper
autoWrapper's default setting is scrolling=“no”. However, it is possible that ifame page switching results not only in different height of the iframe. Also the width may be affected. While the height is automatically adjusted, the width is not. The width fills always up to 100% of the room the template offers. If the width exeeds the template's room, we need a horizontal scrollbar. In that case we change in line 131 of wrapper's index.php file scrolling to: scrolling=\”auto\”.

For more detailed explanations see the wrapper help files.

2. Disclaimer

There is no warrenty using this plugin. It will be used on everybody's own risk. We will not assume any liability in case of data losses caused by Wrapper usage.

3. Acknowledgement

The code of the wrapper had originally been developed by Rolf Amfelt (alf149) as addon (see: CMSimple Forum).

Wrapper
(click image to enlarge)

back to plugins
Check also GXgeturl for comparison

Discussion

Emanuel, 2010/06/22 09:00

Why does wrap() test with fopen()? Therefore it doesn't work with allow_url_fopen=false in php.ini. Is this a bug or a feature?

Tillman Schuster, 2010/10/22 17:59

What do you mean? The wrapper is just an iframe. Do you have an example for your problem?

Till

Christoph M. Becker, 2013/08/15 14:27

All three functions call test_url() to check if the URL is accessible, and show an error notice instead of the IFrame otherwise. As the check is done using fopen(), this fails, if allow_url_fopen = Off in the PHP configuration.

A quick workaround, for those who can't change this PHP setting: change the definition of test_url() in index.php:

function test_url($url) {return true;}
cmsimple.jp, 2013/02/19 06:52

I tested CMSimpleVer4.04

Work!

plugins/wrapper.txt · Last modified: 2013/08/15 14:40 by cmb
Webdesign: NMuD chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0