History of TemplatesPackage

bitweaver uses the [http://smarty.php.net/|Smarty Template Engine].

__NOTE:__ See the TikiSmartyClass in the KernelPackage to see how the work is actually done.

bitweaver uses [http://smarty.php.net/manual/en/templates.from.elsewhere.php|Smarty's Custom Template Resource] technique to load templates. bitweaver also follows TikiWiki''s wonderfully flexible ablility to automatically override templates by creating a copy of that template in your own ThemeStyle.

The custom resource declaration looks like ~~#660000:"resourcetype:resourceowner/resourcename.tpl"~~. Note, this is __NOT a path__. An example would be:
So, resourcetype = 'tikipackage', resourceowner = 'yourpkg', and resourcename = 'yourpkg_show_data.tpl'. To get this file, the actual path KernelPackage would look for is "/path/to/bitweaver/yourpkg/templates/yourpkg_show_data.tpl" (though first it would check for a Style override - see below...)

To compare how templates should be invoked let's compare old and new. In .tpl files, the include should look like:
OLD WAY: {include file=tiki-directory_bar.tpl}
NEW WAY:{include file="tikipackage:directory/directory_bar.tpl"}

In PHP files, the smarty load and assigns should look like
OLD WAY: $smarty->assign('mid', 'tiki-my_tiki.tpl');
NEW WAY: $smarty->assign('mid', 'tikipackge:users/my_tiki.tpl');
OLDWAY: $smarty->fetch("debug/tiki-debug_console_tab.tpl");
NEW WAY: $smarty->fetch( "tikipackage:debug/debug_console_tab.tpl' );

!!!How are templates searched for?
When a template needs to be fetched, the TikiSmartyClass will look in several places for the template. Here is how it works:
# A template is requested, and TikiSmarty has registered get_tiki_template() as the default handler function, so that function gets called.
# get_tiki_template() checks to see if we are requesting a "tikipackage' resource type. If so, it will first check the active ThemeStyle to see if a templatte file with the requested resource name in the styles folder (themes/styles/matrix/header.tpl for example). If it exists in the theme, it will read in that file. If the template file does not exist, it will check in the resource owner's 'templates' folder. If it exists there, it will read in that file. If it is not either place, you will get a "MISSING TEMPLATE" error message.

modules tempaltes are a slightly different beast, and more to come on them.

Page History
03 Nov 2008 (01:02 UTC)
Current • Source
View • Compare • Difference • Source
View • Compare • Difference • Source
View • Compare • Difference • Source
Danny Staple83.151.201.1677
View • Compare • Difference • Source
View • Compare • Difference • Source
View • Compare • Difference • Source