[pmwiki-users] Includes

Patrick R. Michaud pmichaud at pobox.com
Mon Feb 14 08:10:31 CST 2005


On Mon, Feb 14, 2005 at 06:46:09PM +1300, Simon wrote:
> I'm looking for a way to include separate (non wiki) files (generally 
> containing html snippets or calls to javascript) in at both templates 
> and wiki pages levels.

In a template, you can use  <!--file:path/to/template.html-->.

Within a wiki page itself it can be a bit more tricky, because you
probably don't want wiki authors to be able to access arbitrary
files in the file system.  If you can get the files into a single
directory (or populate a directory with symlinks to the files)
it's quite a bit safer:

    Markup('includefile', 'directives',
      '/\\(:includefile\\s+([-\\w.])+:\\)/e',
      "Keep(implode('', file('/path/to/safe/includes/$1')))");

With this in place, the markup (:includefile something.html:) would
include the contents of /path/to/safe/includes/something.html in the
output.

Pm



More information about the pmwiki-users mailing list