Create a folder called templates
inside your plugin directory, and inside create an empty file using the name of your plugin folder, followed by _template.php
. eg. myplugin_template.php
Inside this file add an array by the same name, but in UPPERCASE: eg. $MYPLUGIN_TEMPLATE['xxxx']
xxxx
can be anything you want, but we suggest using start
, item
, end
etc. when applicable. This value should always be lowercase. Here's a simple example of the contents of myplugin_template.php
:
<?php
$MYPLUGIN_TEMPLATE['start'] = "<ul>";
$MYPLUGIN_TEMPLATE['item'] = "<li>{MYPLUGIN_ITEM}</li>";
$MYPLUGIN_TEMPLATE['end'] = "</ul>";
?>
If your plugin will use several different types of templates, eg. a listing page and an input form. You can do something like this:
<?php
$MYPLUGIN_TEMPLATE['list']['start'] = "<ul>";
$MYPLUGIN_TEMPLATE['list']['item'] = "<li>{MYPLUGIN_ITEM}</li>";
$MYPLUGIN_TEMPLATE['list']['end'] = "</ul>";
$MYPLUGIN_TEMPLATE['form']['start'] = "<form>";
$MYPLUGIN_TEMPLATE['form']['body'] = "<div>{MYPLUGIN_FORMINPUT}</divi>";
$MYPLUGIN_TEMPLATE['form']['end'] = "</form>";
?>
Thursday 13 June 2013 - 17:00:00
admin,