( ! ) Warning: session_start(): open(/var/lib/php/session/sess_gl4mhaog5a3ufnnl5nh1n64ot2, O_RDWR) failed: No such file or directory (2) in /var/www/bitweaver/live/users/includes/bit_setup_inc.php on line 82
Call Stack
#TimeMemoryFunctionLocation
10.0001235576{main}( ).../index.php:0
20.0001237632require_once( '/var/www/bitweaver/live/kernel/includes/setup_inc.php' ).../index.php:16
30.01751912592BitSystem->scanPackages( ).../setup_inc.php:141
40.01972256096BitSystem->loadPackage( ).../BitSystem.php:1183
50.01972258616include_once( '/var/www/bitweaver/live/users/includes/bit_setup_inc.php' ).../BitSystem.php:1109
60.02002588776session_start ( ).../bit_setup_inc.php:82

( ! ) Warning: session_write_close(): open(/var/lib/php/session/sess_gl4mhaog5a3ufnnl5nh1n64ot2, O_RDWR) failed: No such file or directory (2) in /var/www/bitweaver/live/kernel/includes/classes/BitSystem.php on line 580
Call Stack
#TimeMemoryFunctionLocation
10.0001235576{main}( ).../index.php:0
20.06034911064include( '/var/www/bitweaver/live/wiki/includes/display_bitpage_inc.php' ).../index.php:50
30.06884965136BitSystem->display( ).../display_bitpage_inc.php:163
40.06894968256BitSystem->preDisplay( ).../BitSystem.php:505
50.07034983040session_write_close ( ).../BitSystem.php:580

( ! ) Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in /var/www/bitweaver/live/kernel/includes/classes/BitSystem.php on line 580
Call Stack
#TimeMemoryFunctionLocation
10.0001235576{main}( ).../index.php:0
20.06034911064include( '/var/www/bitweaver/live/wiki/includes/display_bitpage_inc.php' ).../index.php:50
30.06884965136BitSystem->display( ).../display_bitpage_inc.php:163
40.06894968256BitSystem->preDisplay( ).../BitSystem.php:505
50.07034983040session_write_close ( ).../BitSystem.php:580
TemplatesPackage - bitweaver

TemplatesPackage

How to use Smarty Templates in your Package

Created by: spiderr, Last modification: 03 Nov 2008 (01:02 UTC) by charles
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:

<?php
OLD WAY
: {include file=tiki-directory_bar.tpl}
NEW 
WAY:{include file="bitpackage:directory/directory_bar.tpl"}
?>


In PHP files, the smarty load and assigns should look like

<?php
OLD WAY
$smarty->assign('mid''tiki-my_tiki.tpl');
NEW 
WAY$gBitSmarty->assign('mid''bitpackge:users/my_bit.tpl');
?>

or

<?php
OLDWAY
$smarty->fetch("debug/tiki-debug_console_tab.tpl");
NEW 
WAY$gBitSmarty->fetch"bitpackage:debug/debug_console_tab.tpl" );
?>


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:
  1. A template is requested, and BitSmarty has registered get_bit_template() as the default handler function, so that function gets called.
  2. get_bit_template() checks to see if we are requesting a "bitpackage' 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 templates are a slightly different beast, and more to come on them.