Recent Changes - Search:




Summary: Include html pages into PmWiki 2.x pages
Version: 2007-11-23
Status: stable
Prerequisites: pmwiki-2.0
Categories: Includes
Download: includeurl.phpΔ
Discussion: IncludeUrl-Talk


How can I include the contents of another page in a wiki page?


First, be sure you're aware of the security and possible copyright risks of letting the content of other (arbitrary!) URLs appear in your pages.

Once you've gotten past that hurdle, the following code in your config.php adds a (:includeurl http://...:) markup that lets you embed the contents of other pages into a wiki page.

    Markup('includeurl', 'directives',

Embedding other pages (Alternative Answer)

includeurl.phpΔ lets you embed other pages in a wiki page. Download script, copy to cookbook folder, and install by adding to config.php:

The script adds the markup (:includeurl http://.... [width=..] [height=..] [border=...] [type=...]:)

The included page is an embedded object, size can be determined with width and height parameters (default is width=100% and height=400px). This means the page will display with its own styling etc, not just a crude text content display and erronous inclusion of html head code as happens with above markup. Links will continue to work, as does everything else. Embedding a page as an object is similar to the html iframe element. Internet Explorer 6, 7, Firefox and all modern Mozilla browswers support embedded objects, IE5 and earlier does not.

The parameter iframe=1 or iframe=true will result in the use of the <iframe ..> html tag instead of the more general <object ..> tag. But still use optional parameter border=.. if needed, not frameborder. Note that <iframe> is discontinued in the XHTML 1.1 specification. But some browsers may have difficulties with the use of the <object> tag. If iframe option is not used, browsers will use <object> tag, except IE, which will use <iframe> (since IE seems not to cope with <object> too well).

Setting $EnableExternalResource = 0; will disallow the inclusion of pages with http or https as prefix and still allow inclusion of pages with a relative path url from the same server, for instance like

(:includeurl /samplesite/path/page.html :)

Release history

  • 2007-11-23: Enabled support of UrlApprovals and InterMap links.
  • 2007-04-28: Simplified markup to be kinder to author (no spaces needed at the end). Fixed bug which prevented $EnableExternalResource = 0; of working.
  • 2006-10-28: Added $RecipeInfo
  • 2006-08-03a: Added automatic switch, so IE will use <iframe>, and other browsers <object>. Thanks Dominic!
  • 2006-08-03: Added iframe=1 or iframe=true option, to use <iframe> html tag instead of the more general <object> tag
  • 2006-08-02: Changed type= to be optionally set within the markup, default is type="text/html".
  • 2006-07-17: added type="text/html" to code to make it more browser friendly (thanks Christian!)
  • 2006-04-24: original release


Here's an example that includes the contents from into this page:



  • This will emit some very ugly-looking error messages if the included URL times out. Joachim Durchholz April 11, 2005, at 07:25 AM
  • Maybe this could be used with ApproveURLs so that it would not be as insecure? - Martin Fick
  • URLs must point to files which do not cause a redirect. So pointing this to a directory will usually cause the server to send a redirect to index.html which will work in a browser, but fail with this recipe. (~from the mailing list)
  • I've noticed that IncludeUrl didn't work with IE or Netscape (and by report not with Firefox either). It might be that these browsers don't support <object>...</object>?? Is there a known workaround? 2006-07-17, chr

Markup for https

To get https to also work with the includeurl markup, use the following:

    Markup('includeurl', 'directives',

Markup when allow_url_fopen is disabled

On some systems the option to open files via their URI is diasbled. One can bypass this by using a class that emulates the identical behavior.

Download browseremulator.class.phpΔ and place into the cookbook/ directory.

Place this into the local/config.php file:

	function BrowserEmulatorFile($file){
		$BrowserEmulator = new BrowserEmulator(); 
		return implode('',$BrowserEmulator->file($file));

	Markup('includeurl', 'directives',


Did I mention that this can be a really dangerous thing to allow on an open-edit website?

See Also




See discussion at IncludeUrl-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 22, 2013, at 02:27 AM