ComplexRecipes

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


These are some guidelines for people who want to share complex cookbook recipes with other PmWiki users.

Distribution

  • Choose a good name for your extension. Below, we use "foo"; that's not a good name!
  • Put your extension into a tarball or zip file (or both).
  • The tarball or zip file should create a directory with the name of the extension and the version number, like foo-0.1.
  • Include license information (such as a COPYING file).
  • Include a README file, with installation and other instructions.
  • The files in the directory should lay out like this:
 foo-0.1/
     COPYING.foo (license info)
     README.foo (install & other instructions)
     cookbook/
         foo.php (single script, loads others if necessary)
         foo/
            bar.php
            baz.php
     pub/
         foo/
            [any skins, images, etc.]
     wikilib.d/
         Foo.HomePage (documentation in PmWiki format)
         Foo.OtherDocumentation
  • Installation should consist of opening the tarball, copying the files recursively to the PmWiki directory ("cp -r foo-0.1/* pmwiki"), throwing a include_once('cookbook/foo.php') into the local/config.php file, and that should be it. Have reasonable defaults for any configuration variables.

Coding guidelines

  • In the first couple of lines of your extension, define a constant for your extension so other code can tell that it's loaded.
  define(FOO_VERSION, '0.1'); 
  • Try to follow PmWiki's variable- and function-naming practices (CamelCase for everything). That makes it easier for everyone.
  • For configuration variables, prefix the variable name with the name of your extension, to avoid clashes. For example, don't use a variable $Count; use $FooCount instead.
  • Use the SDV() function for your config variables.

See also

pmwiki-2.2.113 -- Last modified by {{}}?

from IP: 85.171.160.186 ip should be disabled by default for security reasons