X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/21bb9de4964a8d58355606213d94fa570b1a5af3..8e2fb374e03ee2122fcfb678fd851673ca86eefa:/doc/plugins/write.mdwn?ds=sidebyside diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 25ea8a98e..416f1b86e 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -128,17 +128,28 @@ return the htmlized content. hook(type => "pagetemplate", id => "foo", call => \&pagetemplate); -[[Templates]] are filled out for many different things in ikiwiki, like -generating a page, or part of a blog page, or an rss feed, or a cgi. This -hook allows modifying those templates. The function is passed named -parameters. The "page" and "destpage" parameters are the same as for a -preprocess hook. The "template" parameter is a [[cpan HTML::Template]] -object that is the template that will be used to generate the page. The -function can manipulate that template object. +[[Templates|wikitemplate]] are filled out for many different things in +ikiwiki, like generating a page, or part of a blog page, or an rss feed, or +a cgi. This hook allows modifying the variables available on those +templates. The function is passed named parameters. The "page" and +"destpage" parameters are the same as for a preprocess hook. The "template" +parameter is a [[cpan HTML::Template]] object that is the template that +will be used to generate the page. The function can manipulate that +template object. The most common thing to do is probably to call `$template->param()` to add a new custom parameter to the template. +### templatefile + + hook(type => "templatefile", id => "foo", call => \&templatefile); + +This hook allows plugins to change the [[template|wikitemplate]] that is +used for a page in the wiki. The hook is passed a "page" parameter, and +should return the name of the template file to use, or undef if it doesn't +want to change the default ("page.tmpl"). Template files are looked for in +/usr/share/ikiwiki/templates by default. + ### sanitize hook(type => "sanitize", id => "foo", call => \&sanitize); @@ -181,7 +192,7 @@ source files that were rendered. Use this to hook into ikiwiki's cgi script. Each registered cgi hook is called in turn, and passed a CGI object. The hook should examine the -parameters, and if it will handle this CGI request, output a page and +parameters, and if it will handle this CGI request, output a page (including the http headers) and terminate the program. ### auth @@ -197,6 +208,15 @@ object's "name" parameter to the authenticated user's name. Note that if the name is set to the name of a user who is not registered, a basic registration of the user will be automatically performed. +### sessioncgi + + hook(type => "sessioncgi", id => "foo", call => \&sessioncgi); + +Unlike the cgi hook, which is run as soon as possible, the sessioncgi hook +is only run once a session object is available. It is passed both a CGI +object and a session object. To check if the user is in fact signed in, you +can check if the session object has a "name" parameter set. + ### canedit hook(type => "canedit", id => "foo", call => \&pagelocked); @@ -361,6 +381,7 @@ control some options. These are: * forcesubpage - set to force a link to a subpage * linktext - set to force the link text to something * anchor - set to make the link include an anchor +* rel - set to add a rel attribute to the link. #### `readfile($;$)` @@ -422,7 +443,9 @@ This is the standard gettext function, although slightly optimised. #### `urlto($$)` -Construct a relative url to the first parameter from the second. +Construct a relative url to the first parameter from the page named by the +second. The first parameter can be either a page name, or some other +destination file, as registered by `will_render`. #### `targetpage($$)`