bz template facilities
The first aspect of bz that can prove useful immediately is its templates
facility.
The key idea here is to store in only one html file the parts that all several
pages of the site have in common. For instance, on this website, everything
but the area where this text is kept from one page to the other.
What was defined in only a bz:page template, that can be called in all the pages.
For instance, to build a page containing the text "hello world" in
this area, the source code is :
{ bz:page style="common.html" }
Hello world!
{ bz:endpage}
As for the style source, it is only an html page with the { bz:content}
keyword in the zone which changes from page to page. It can be seen here .
The compiler crops everything that is out of the { bz:page} ... { bz:endpage}
zone. It is useless to clean html code by yourself if you use an wysiwyg html
editor.
The general format is :
{ bz:page style="name_of_the_file" include="file1,file2..."
perms="class1,class2" var1="value1" ... }
All arguments are optional.
- style is the name of the file to use as a template. It should be stores in the
pages_dir (see bz.conf for details).
-
include is a list of comma separated filenames to be included. These files should
be stored in the code_dir. It only exists to avoid the use of any php keyword
in the html files. Same as <? php include_once('file1'); ... ?>
-
perms is a list of classes that are allowed to access the page. For more details
see the authentification section.
Every other name=value pair are initialised as global php variables.
For a full example of the template facility, download the documentation in the download section.
This archive contains the source for this website as well as the website itself. It may be a good
start to explore bZ's possibilities.
For small parts of pages that are also used often (let's call them 'cards'),
the keyword { bz:load} should be of help.
Its format is :
{ bz:load card="filename" arg1=value1 arg2=value2
... }
The card file is inserted instead of the keyword and the arguments are initialized
as global variables.
The file's path is taken beginning in the cards_dir directory.
For templates that depend on other templates, recompile the site several times until the compiler
prints "website up to date".
|