Test of templates functions

Function _render( $view , $params )

Rendering of a view file with arguments:

    _render('test.htm', array('args'=>array('one', 3=>'two', 123)));
array('one', 3=>'two', 123))); ?>

Rendering of a non-existing view file:

Test functions

_isfalse( $val ), _isnotfalse( $val ), _istrue( $val ), _isnottrue( $val ), _isnull( $val ), _isnotnull( $val )

    $val = 'a value';
    if (_isfalse($val)) echo "Value was false";
    else echo "Value was not false";

Test with a non-existing variable:

    if (_istrue($qsdf)) echo "Value was false";
    else echo "Value was not false";

_if( $condition , $if_true , $if_false )

    $val = 'a value';
    _if( _isfalse($val), "Value was false", "Value was not false" );

Test with a callback function:

    $val = 'a value';
    _if( _isfalse($val), "Value was false", function($condition){ $var = ucfirst('tested'); echo "Value $var was not false!!"; } );

_else( $condition , $if_false , $if_true )

    $val = 'a value';
    _else( _isfalse($val), "Value was not false", "Value was false" );

Test with a callback function with arguments:

    $val = 'a value';
    _else( _isfalse($val), 
        function($condition, $args=null){ $var = ucfirst($args); echo "Value $var was not false!!"; },
        function($condition, $args=null){ $var = ucfirst($args); echo "Value $var was false!!"; },
        array( 'my callback argument' )
    );

Test with a callback function that send an error:

    $val = 'a value';
    _else( _isfalse($val), 
        function($condition){ fopen(); },
        function($condition){ fopen(); }
    );

Function _dump( $array , $only_string_index , $mask_item , $mask_global , $no_index_mask )

    $table = array(
        'a value',
        'my index'=>'another value',
        4=> 0987.234,
        array('one', 'two', 'three')
    );
    _dump($table);
'another value', 4=> 0987.234, 'another index'=>true, array('one', 'two', 'three') ); _dump($table); ?>
    _dump($table, true);

Function _attribute( $var , $val )

    echo "<a "._attribute('href', 'http://www.google.fr/').">google.fr link</a>";

Function _cut( $str , $count=120 , $suffix=' ...' )

    $str = _loremipsum('short', true);
    _para( _cut($str, 120, ' ...', true) );
    _para( _cut($str, 60, ' read more', true) );
read more', true) ); ?>