diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-12-07 17:44:46 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-12-07 17:44:46 +0000 |
commit | 76f2571a7cc0c89c803a3315b5016d495dc3a116 (patch) | |
tree | 610f8ad2e2a3bfb5e500faf9d0cef79fc52c9e52 /doc | |
parent | fb2c3ab3b5e6c9bade718394960bda20e408715d (diff) | |
download | ikiwiki-76f2571a7cc0c89c803a3315b5016d495dc3a116.tar ikiwiki-76f2571a7cc0c89c803a3315b5016d495dc3a116.tar.gz |
web commit by ManojSrivastava
Diffstat (limited to 'doc')
-rw-r--r-- | doc/patchqueue/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/patchqueue/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn b/doc/patchqueue/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn new file mode 100644 index 000000000..e617f17c1 --- /dev/null +++ b/doc/patchqueue/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn @@ -0,0 +1,14 @@ +varioki - Add variables for use in ikiwiki templates + +This plugin attempts to provide a means to add templates for use in ikiwiki templates, based on a hash variable set in the ikiwiki configuration file. The motivation for this plugin was to provide an easy way for end users to add information to be used in templates -- for example, my "Blosxom" blog entry template does fancy things with the date components of the entry, and there was no easy way to get that information into the template. Or if one wants to have a different page template for the top level index page than for the rest of the pages inthe wiki (for example, to only put special content, like, say, 'last.fm" play lists, only on the front page). + +This plugin hooks itsef into the "pagetemplate" hook, and adds parameters to the appropriate templates based on the type. For example, the following inserted into "ikiwiki.setup" creates "TMPL_VAR MOTTO" and "TOPLVL" which can then be used in your templates. + + varioki => { + ’motto’ => ’"Manoj\’s musings"’, + ’toplvl’ => ’sub {return $page eq "index"}’ + }, + +For every key in the configured hash, the corresponding value is evaluated. Based on whether the value was a stringified scalar, code, array, or hash, the value of the template parameter is generated on the fly. The available variables are whatever is available to "pagetemplate" hook scripts, namely, $page, $destpage, and $template. Additionally, the global variables and functions as defined in the Ikiwiki documentation (<http://ikiwiki.kitenet.net/plugins/write.html>) may be used. + +ManojSrivastava
\ No newline at end of file |