array_pop($args); # drop '{'
$tem =& tem_push($tem); # create a new sub-template
$tem['parent']['pieces'][] =& $tem; # as a piece of the parent
$tem['name'] = $name;
$tem['pieces'] = array();
$tem['args'] = $args;
array_pop($args); # drop '{'
$tem =& tem_push($tem); # create a new sub-template
$tem['parent']['pieces'][] =& $tem; # as a piece of the parent
$tem['name'] = $name;
$tem['pieces'] = array();
$tem['args'] = $args;
function fill_template($template, &$data, &$context = NULL) {
$context =& tem_push($context);
$context['data'] =& $data;
function fill_template($template, &$data, &$context = NULL) {
$context =& tem_push($context);
$context['data'] =& $data;
$rows =& tem_row_data($tem, $context);
$context['rows'] =& $rows;
foreach($rows as $key => &$row) {
$rows =& tem_row_data($tem, $context);
$context['rows'] =& $rows;
foreach($rows as $key => &$row) {
return $ret;
}
function tem_get_data($key, $context) {
$scope = tem_data_scope($key, $context);
return $ret;
}
function tem_get_data($key, $context) {
$scope = tem_data_scope($key, $context);
- $value = $auto_func($scope['data'][$key], $key, $scope, $tem['args']);
+ $value = $auto_func($value, $key, $scope, $tem['args']);
function merge_sub_templates(&$main, &$subs) {
foreach($main['pieces'] as &$piece) {
if(is_array($piece)) { # not just text
function merge_sub_templates(&$main, &$subs) {
foreach($main['pieces'] as &$piece) {
if(is_array($piece)) { # not just text
- $sub = $subs[$piece['name']];
- if($sub and $sub['args'][0] != 'hide') {
+ $sub = isset($subs[$piece['name']]) ? $subs[$piece['name']] : null;
+ $arg0 = isset($sub['args'][0]) ? $sub['args'][0] : null;
+ if($sub && $arg0 != 'hide') {