Wrapper - including autoWrapper

Plugin for CMSimple

Version 2.4 beta 1 (27th April 2009)

Example 1
"Wrapper" in action

Example 2
"autoWrapper" in action

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 two functions, the normal wrapping and the auto-wrapping function.

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

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

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. Which one of the two works better under certain conditions has to be tested.


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);#


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

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


(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 "Google", for example, as it is shown in the upper image, the following code has been used:

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

To embed the Quick.Cart shop, for example, as it is shown in the lower image, the following code has been used:

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


In the 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://www.google.de", "100%", "500", "auto", "", "Site is loading", "Page cannot be found");#

Of course, you can run autowrapper on more than one CMSimple pages.


If you want to show an image instead of text during loading time, you may say:
#CMSimple $output.= wrap("http://www.google.de", "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".

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, the autowrapper still has to perform.

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

Both autowrap functions are javascripts. Recent reports have mentioned (April 2009), that the Internet Explorer 8 may have problems with the wrapper, if javascripts of additional plugins (for example lightbox etc.) are incorporated in the template. The autosize() function will fail. This problem, however, can be avoided by adding the javascript loading tags above CMSimple's head() function of the template.


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

© Tillman Schuster, NMuD, 2007 - 2009.