Include one page in another

This function lets you insert the data of one page into another without having to worry about formatting an iframe, and without the restriction of the javascript wikilet. Call it like so:

<script>
widget.includePage(pageName,obj,mode);
</script>

The parameters are as follows:

pageName is the name of the page to include, as a string
obj is the object to insert the data into. Default is to create a new <div> on the fly and write to that.
mode is a string representing how to add the data. Possible values are "append", "prepend", and "replace". Default is "replace".

For example, this is the result of doing <script>widget.includePage("SideBar")</script> inside a breakout box (and font sized a bit smaller):


Using the other parameters, you can do all kinds of neat stuff, loading pages and inserting them anywhere.

WARNING: if you use the obj parameter, make sure that the element is completely loaded, or you'll run into problems. The best way to do that is to use the library function onDocLoad, which calls a handler only when the page contents are loaded, to call it indirectly.


Page Information

  • 1 year ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts