YF built-in template engine update:
if_func feature was upgraded today by providing ability to pass several variables instead of one.
This allows to create more complex conditions inside templates without need of additional actions.
Also, it is possible to change inner mulitple condition by adding “_or”, “_and” to function name.
This new addition also works will all other “if_func” features:
* custom functions
* negating of each comparison
* function shortcuts (“ok”, “not_ok”, “empty”, “isset”, etc)
* validation class usage
Lets go to examples:
// Imagine this kind of array: $data = array( 'name1' => '', 'name2' => 'something', 'name3' => '', 'name4' => 'other', 'name5' => '', 'name6' => 'gggggg' ); // and inside templates you can do now: ------------ {if_not_ok(name1,name3)}good{/if} {if_not_ok(name1,name2)}bad{else}good{/if} {if_or_ok(name1,name2)}good{/if} {if_and_empty(name1,name3,name5)}good{/if} {if_and_not_empty(name2,name4,name6)}ok{/if} {if_not_isset(name777,name888,name999)}good{/if}
As usual, there were added unit tests for this new feature:
https://github.com/yfix/yf/blob/master/.dev/tests/tpl/tpl_driver_yf_core.Test.php#L400