Code Monkey home page Code Monkey logo

blitz-featured's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.