Skip to content

Latest commit

 

History

History
61 lines (49 loc) · 2.77 KB

README.md

File metadata and controls

61 lines (49 loc) · 2.77 KB

Installing blitz

phpize
./configure
make
make install

Blitz is a fast and powerfull template engine for very big internet projects

As the author said:

The reason why Blitz objects are called "template controllers" is simple. From the very early days template language in Blitz was designed to be as simple ("non-programming") as possible. For example, there is still no "for" or "foreach" statement in Blitz. This surely doesn't mean you can't do any looping :) But you have to loop from your PHP-code, this is called "passive" templates (in Blitz you can do a lot of "active" templating as well - conditions, callbacks, plugins - but loops like "foreach", complex expressions, all these "programming" statements are still under the law).

Blitz(til v0.8.6) does not support PHP-like "for" or "foreach" loop statement for design's sake, but you can still use PHP code to make loop things, like this:

$View = new Blitz();
$View->load('hello {{ BEGIN block }} {{ $name }} {{ END }}');
$View->display(
    array('block' => array(
        array('name' => 'Dude'),
        array('name' => 'Donny'),
        array('name' => 'Sobchak'),
    ))
);

As shown above, BLOCK aka BEGIN statement in Blitz actually iterates an Array's elements and assigns them into the template, but to achieve this situation you'll have to format the input var into a nested array, that might be much clear for complex inputs, but also looks horrible if we just wana to render a simple list like 'name' => array('Dude', 'Donny', 'Doggy'), so i mix this little feature into the original Blitz projects.


Usage:

  1. Quick geek tutorial(Original version - Alexey A. Rybak (c) 2005 - 2012)

  2. Changes

    1. FOREACH statement added(see Diff):
     load($body);
         $T->display(array("list"=>array('a', 'b', 'c'));
     ?>
     
    1. predefined $_k and $_v(see Diff), array index $_k start from 0 and $_num start from 1;
    2. add longer logic check(see Diff):
      b}}a > b{{ END }}";
         $t = new Blitz();
         $t->load($body);
         $t->display(array("a"=>3, "zc"=>2, "b"=>0));
     ?>
     

    can only parse logic check arguments by order, do not support Parentheses