Changeset 441 for trunk/patTemplate.php
- Timestamp:
- 08/08/06 23:10:42 (2 years ago)
- Files:
-
- trunk/patTemplate.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/patTemplate.php
r438 r441 716 716 * @see addVar(), addRows(), addGlobalVar(), addGlobalVars() 717 717 */ 718 function addVars( $template, $variables, $prefix = '' )719 { 720 $template = strtolower( $template);721 $prefix = strtoupper( $prefix);722 $variables = array_change_key_case( $variables, CASE_UPPER);718 function addVars($template, $variables, $prefix = '') { 719 720 $template = strtolower($template); 721 $prefix = strtoupper($prefix); 722 $variables = array_change_key_case($variables, CASE_UPPER); 723 723 724 724 foreach ($variables as $varname => $value) { … … 810 810 function addObject( $template, $object, $prefix = '', $ignorePrivate = false ) 811 811 { 812 if ( is_array( $object )) {812 if (is_array($object)) { 813 813 $rows = array(); 814 foreach ($object as $o) {815 array_push( $rows, $this->getObjectVars($o, $ignorePrivate));814 foreach ($object as $o) { 815 array_push($rows, $this->getObjectVars($o, $ignorePrivate)); 816 816 } 817 817 818 818 return $this->addRows( $template, $rows, $prefix ); 819 819 } elseif (is_object($object)) { 820 return $this->addVars( $template, $this->getObjectVars($object, $ignorePrivate), $prefix);820 return $this->addVars($template, $this->getObjectVars($object, $ignorePrivate), $prefix); 821 821 } 822 822 return false; … … 1743 1743 foreach( $this->_templates[$template]['vars'] as $key => $value ) 1744 1744 { 1745 if( is_array( $value ) ) 1746 { 1747 if( count( $this->_templates[$template]['currentDependencies'] ) == 1 ) 1748 { 1749 $child = $this->_templates[$template]['currentDependencies'][0]; 1745 if (is_array($value) || is_object($value)) { 1746 if (count($this->_templates[$template]['currentDependencies'] ) == 1) { 1747 $child = $this->_templates[$template]['currentDependencies'][0]; 1748 } else { 1749 if (isset($this->_templates[$template]['attributes']['child'])) { 1750 $child = $this->_templates[$template]['attributes']['child']; 1751 } else { 1752 continue; 1753 } 1750 1754 } 1751 else 1752 {1753 if( isset( $this->_templates[$template]['attributes']['child'] ) )1754 $child = $this->_templates[$template]['attributes']['child'];1755 else1756 continue;1755 1756 $this->setAttribute( $child, 'autoclear', 'yes' ); 1757 if (is_object($value)) { 1758 $this->addObject($child, $value, $key . '_'); 1759 } else { 1760 $this->addVar( $child, $key, $value ); 1757 1761 } 1758 1759 $this->setAttribute( $child, 'autoclear', 'yes' );1760 $this->addVar( $child, $key, $value );1761 1762 continue; 1762 1763 }
