Brian sent me this in an email, and without this knowledge it woudl be difficult to use btemplate to its
 full capacity.

Some of it I wrote, some of it he wrote. Its just general info till the docs get updated

-----

1. New Feature: If
Making an if is alot like making a normal tag, except you must include a third parameter. Example:

$isadmin = is_admin();
$tpl->set('is_admin',$isadmin,TRUE);
In this example, is_admin() returns TRUE or FALSE. It is important to realize that in order for your IF to work properly, you MUST have the third parameter be true, and the second parameter be TRUE or FALSE. Heres an example of the tpl for an if:
<if:is_admin>
	Hello there, admin!
</if:is_admin>
If is a very powerful feature of bTemplate. Use it wisely. 2. New Feature: Case Loops. This is my implementation to take care of the problems you mentioned earlier about things like form elements that must have a 'selected' in certain instances. Instead of implementing an '<if:' comparison test like we talked about, I decided to approach the problem a different way. Attached is an example. 'default' is a reserved word and happens on ever loop UNLESS a separate 'case' is found (and you set cases in your script). So basically, you have a loop that looks like this:
	<cloop:cloop>
		<default>
			<option value="<tag:cloop[].key />"><tag:cloop[].value /></option>
		</default>
		<selected>
			<option value="<tag:cloop[].key />" selected><tag:cloop[].value /></option>
		</selected>
	</cloop:cloop>
Here is the corrosponding $cloop array:
$cloop = array(
	0 => array(
		'key' => 27,
		'value' => 'String 27'),
	1 => array(
		'key' => 28,
		'value' => 'String 28'),
	2 => array(
		'key' => 29,
		'value' => 'String 29',
		'case' => 'selected'),
	3 => array(
		'key' => 30,
		'value' => 'String 30'));
Notice that the 2 key has an extra key called 'case' - this is what the template engine looks for. If it DOESN'T find a 'case', it uses 'default' as the case. So always put a <default> in your cloops. The GOOD thing about this is that you can have as many cases as you want, and you can name them whatever you want. In the above example, 'selected' is a name I just chose for that loop. CURRENTLY, you have to make an array with all available cases (besides 'default', that is taken care of automatically). So in this example, I made an array like:
$cases = array('selected');
...since I only had one extra case I needed to account for. But I could have just as easily added two or three...
$cases = array('selected', 'disabled', 'invisible');
Then when you set your cloop you have to pass the array you are iterating over as well as the case array.
$tpl->set_cloop('cloop', $cloop, $cases);