diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 25a43670..d92d4a36 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -193,6 +193,7 @@ class TTemplate extends TApplicationComponent implements ITemplate * @var boolean whether this template is a source template
*/
private $_sourceTemplate=true;
+ private $_tplControl=null;
/**
@@ -257,6 +258,7 @@ class TTemplate extends TApplicationComponent implements ITemplate */
public function instantiateIn($tplControl)
{
+ $this->_tplControl=$tplControl;
if(($page=$tplControl->getPage())===null)
$page=$this->getService()->getRequestedPage();
$controls=array();
@@ -383,7 +385,13 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->bindProperty($name,$value[1]);
break;
case self::CONFIG_EXPRESSION:
- $component->autoBindProperty($name,$value[1]);
+ if($component instanceof TControl)
+ $component->autoBindProperty($name,$value[1]);
+ else
+ {
+ $setter='set'.$name;
+ $component->$setter($this->_tplControl->evaluateExpression($value[1]));
+ }
break;
case self::CONFIG_TEMPLATE:
$setter='set'.$name;
@@ -429,7 +437,10 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->bindProperty($name,$value[1]);
break;
case self::CONFIG_EXPRESSION: // expression
- $component->autoBindProperty($name,$value[1]);
+ if($component instanceof TControl)
+ $component->autoBindProperty($name,$value[1]);
+ else
+ $component->setSubProperty($name,$this->_tplControl->evaluateExpression($value[1]));
break;
case self::CONFIG_TEMPLATE:
$component->setSubProperty($name,$value[1]);
@@ -801,7 +812,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
foreach($attributes as $name=>$att)
{
- if(is_array($att) && ($att[0]===self::CONFIG_DATABIND || $att[0]===self::CONFIG_EXPRESSION))
+ if(is_array($att) && ($att[0]===self::CONFIG_DATABIND))
throw new TConfigurationException('template_databind_forbidden',$type,$name);
if(($pos=strpos($name,'.'))!==false)
{
|