bitweaver uses the [http://smarty.php.net/|Smarty Template Engine].
|
|
-__NOTE:__ See the BitSmarty class in the KernelPackage to see how the work is actually done.
|
+__NOTE:__ See the ((BitSmarty)) class 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.
|
+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:
|
"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:
|
- OLD WAY: {include file=tiki-directory_bar.tpl}
|
- NEW WAY:{include file="bitpackage:directory/directory_bar.tpl"}
|
+{code} |
+OLD WAY: {include file=tiki-directory_bar.tpl} |
+NEW WAY:{include file="bitpackage:directory/directory_bar.tpl"} |
+{/code} |
|
In PHP files, the smarty load and assigns should look like
|
- OLD WAY: $smarty->assign('mid', 'tiki-my_tiki.tpl');
|
- NEW WAY: $gBitSmarty->assign('mid', 'bitpackge:users/my_bit.tpl');
|
+{code} |
+OLD WAY: $smarty->assign('mid', 'tiki-my_tiki.tpl'); |
+NEW WAY: $gBitSmarty->assign('mid', 'bitpackge:users/my_bit.tpl'); |
+{/code} |
or
|
- OLDWAY: $smarty->fetch("debug/tiki-debug_console_tab.tpl");
|
- NEW WAY: $gBitSmarty->fetch( "bitpackage:debug/debug_console_tab.tpl' );
|
+{code} |
+OLDWAY: $smarty->fetch("debug/tiki-debug_console_tab.tpl"); |
+NEW WAY: $gBitSmarty->fetch( "bitpackage:debug/debug_console_tab.tpl" ); |
+{/code} |
|
!!!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:
|