History of TemplatesPackage
Version 5 | Current version | |
---|---|---|
NOTE: See the TikiSmartyClass in the KernelPackage to see how the work is actually done. TikiPro uses Smarty's Custom Template Resource technique to load templates. TikiPro 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 "resourcetype:resourceowner/resourcename.tpl". Note, this is NOT a path. An example would be: "tikipackage:yourpkg/yourpkg_show_data.tpl" 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/tikipro/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: Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page. NEW WAY: Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page. 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'); or 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:
modules tempaltes are a slightly different beast, and more to come on them. | bitweaver uses the Smarty Template Engine. NOTE: See the BitSmarty class in the KernelPackage to see how the work is actually done. bitweaver uses 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 "resourcetype:resourceowner/resourcename.tpl". Note, this is NOT a path. An example would be: "bitpackage:yourpkg/yourpkg_show_data.tpl" So, resourcetype = 'bitpackage', 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:
In PHP files, the smarty load and assigns should look like
or
How are templates searched for?When a template needs to be fetched, the BitSmarty class will look in several places for the template. Here is how it works:
modules templates are a slightly different beast, and more to come on them. |