My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 01, 2009 by mx.morin
insertFrame  
Insert a frame in a node

Installation

  1. Extract insertFrame for drupal 5 or insertFrame for drupal 6 file in the modules directory (Or see download page)
  2. Enable the module in the admin settings
  3. Add the filter to an input format.

Use

To insert a frame in a node in drupal, add the following :

[[[<url> width=<w> height=<h> scrolling=<yes|no|auto> className=<class> ID=<id> offset=<offset> allowtransparency=<true|false>]]]

Param Req Default Desc
url Y N/A Url of the page
w N 100% Size as css declaration (%,px,em)
h N 100% Height as css declaration (%,px,em). if height=100% and url is in the same domain as web site, the height will be ajusted to the real height of the source
scrolling N no Scrollbar settings. Values from IFRAME tag
class N N/A Name of a CSS class
ID N false Id and name of the frame
allowtransparency N N/A Allow (true) or not (false) iframe transparency
offset N 15 offset is a number to add to correct (if needed) auto calculated height

Don't forget to set the input format the filter has been assigned to.

Examples

  1. To include the page www.myurl.com/myapp.html with auto-height with a width of 100%
  2.      [[[www.myurl.com/myapp.html]]]
  3. To include the page www.myurl.com/myapp.html with height of 500px and width of 300px
  4.      [[[www.myurl.com/myapp.html height=500px width=300px]]]
  5. To include a frame of id myframe with the myCSSClass css class
  6.      [[[www.myurl.com/myapp.html id=myframe class=myCSSClass]]]

Features

Version 1.x :

You can add your own tags (tag=value). To custom code with this tags, you must create a theme function. To do this, add in your template.php a function called yourtheme_insertFrame_custom($onload, $iframe_params). The first param is the default code of onload event, the second, an array of all tags of the filter. You function may return any text that will be add as is in the IFRAME html tag. You can also theme the function insertFrame_init to add javascript for example.

Exemple :

// Add javascript
function mytheme_insertFrame_init() {
    drupal_add_js(drupal_get_path('module', 'insertFrame') . '/myinsertFrame.js');    
}

// Add resizing feature if resize=Y
function yourtheme_insertFrame_custom($onload, $iframe_params) {
    if ($iframe_params["resize"] != "Y") {return $onload;}
    return $onload . " onresize='resize(this)'";
}

Theming insertFrame_getURL($url) function, you can customize the url (with token module for example). To theme the function, see this example :

      function yourtemplage_insertFrame_getURL($url) {
        return token_replace($url);
      }    

Version 2.x

All tags can be rendered as your own by using themed function (see insertFrame_theme()) or by creating insertFrame_render_<the tag to render> function. Both have two parameters :

  1. $value : Value of the tag
  2. params : Array of all params and values

Functions must return html output to render the tag.

Exemple :

function insertFrame_render_resize($value, $params) {
    if ($value != "Y") {return "";}
    return "onresize='resize(this)'";}
} 

By default, all non-themed tags are rendered as is (tag="value"). For example, to add transparency behaviour, type :

   [[[url allowtransparency=true]]]

insertFrame_getURL() and insertFrame_custom() have been deleted. Migrate them to insertFrame_render_url and insertFrame_render_<tag>

To insert spaces in tag's values, replace them by %20.

   [[[url style="border:1px%20solid%20red"]]]

Support of Token module for url

Remarks


Comment by chantal.perugino, Sep 30, 2009

Hello, I'm new to Drupal and I would like to add the allowtransparency = true to the inserted iframe. I never added a function to my template.php. Would this be possible? Chantal

Comment by mx.morin, Oct 01, 2009

Add in your template.php :

function <name of your template>_insertFrame_custom($onload, $iframe_params) {
   return $onload . " allowtransparency='true'";
}
Comment by mx.morin, Oct 01, 2009

Or get release 1.9b with allowtransparency=true tag


Sign in to add a comment
Hosted by Google Code