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:
$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";
$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!!"; } );
$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(); } );
$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);
echo "<a "._attribute('href', 'http://www.google.fr/').">google.fr link</a>";
$str = _loremipsum('short', true); _para( _cut($str, 120, ' ...', true) ); _para( _cut($str, 60, ' read more', true) );
read more', true) ); ?>