LOGO

SourceForge.net Logo

plugins

under the hood plugins

There is one script which runs after the whole page has been built which you can use to apply any final tweaks before the page is delivered. For example you might want to:
  • modify how a header works in ways that style sheets can't
  • change the meta keywords on a page to be more relevent to the content
  • make a new token I haven't thought of yet, such as 'LASTEDITED', or welcome, USERNAME
In fact you can do anything you like in this script, but if it gets too long - you consider that it might be more of a plugin, or that you need a beefier Content management system.

architecture

docTree leaves a gap in its page building process right at the end for you to write your own modifications to the code of the page, like this

include (findfile("custom.php"));
die($tplStr);

before finally spitting out the rendered web page. All the global variables and functions of docTree are available to this custom script.

The findfile() means that this script can be placed in a website's own custom directory, or nearer the root, where it will be found by its siblings and cousins. If there is more than one custom script applicable to a site, then the deeper ones need to include the next shallowest. Typically, this means that custom/custom.php would have to include ../custom.php (that address is relative to view.php).

Most of docTree works using a token replacement system. The template is full of tokens and they are replaced by context specific data, such as the requested page, or its last-modified date, or its relatives according to SITEMAP. This method is all that's required to plug a script in.

  1. put text, links and a token on a wiki page. You should really use the given syntax, an html comment, but its up to you what expression you want to find and replace. Your token might be something for the regular expression parser, as long as you can find and replace it. This method is very flexible in that it allows you to mix text / editable content on a page with generated / automated content.
  2. write something in custom.php which replaces the token. There is nothing to stop you referring to a database or using the GET and POST. You can include other scripts probably also in your custom directory. When you've prepared the text you want to put replace the token by, the page is parked in the $tplStr, so replace the token inside that:

$tplStr=str_replace("<!--MYTOKEN-->", $myReplacement, $tplStr);

This script is custom.php lives in the custom directory, so if you have permission, you can edit it online and even start writing plugins.
Any files with csv, txt or php extensions in the custom directory can be edited inline.

plugins available (unsupported):


contacts database

This is a flat file script that runs instead of browse.php and works with three csv files working like database tables to record people, flags, and the links between them Flags can be created and assigned easily, and used for mailing lists. Contacts can be easily exported in csv format.


blog

replaces view.php. Put's an invitation to comment at the bottom of every page. This will be re-worked shortly to work as a token and will be integrated to the rest of the system.


coming soon

Acronym manager

^ back to top

mail matthew