summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TTemplateManager.php
diff options
context:
space:
mode:
authorxue <>2006-03-01 22:37:01 +0000
committerxue <>2006-03-01 22:37:01 +0000
commit7ff8cb8f320e119bc20e7282384db7b223209c29 (patch)
tree5f0468e20d0c26ca1334849cef98b3635735f3a7 /framework/Web/UI/TTemplateManager.php
parent83cce043e7364367d4365752ba8c1ed807dd5557 (diff)
Added support to dynamic ID and SkinID.
Diffstat (limited to 'framework/Web/UI/TTemplateManager.php')
-rw-r--r--framework/Web/UI/TTemplateManager.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 0d2471f3..b2b2f830 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -269,32 +269,42 @@ class TTemplate extends TApplicationComponent implements ITemplate
if(isset($object[2])) // component
{
$component=Prado::createComponent($object[1]);
+ $properties=&$object[2];
if($component instanceof TControl)
{
$controls[$key]=$component;
$component->setTemplateControl($tplControl);
- if(isset($object[2]['id']))
- $tplControl->registerObject($object[2]['id'],$component);
- if(isset($object[2]['skinid']))
+ if(isset($properties['id']))
{
- $component->setSkinID($object[2]['skinid']);
- unset($object[2]['skinid']);
+ if(is_array($properties['id']))
+ $properties['id']=$component->evaluateExpression($properties['id'][1]);
+ $tplControl->registerObject($properties['id'],$component);
+ }
+ if(isset($properties['skinid']))
+ {
+ if(is_array($properties['skinid']))
+ $component->setSkinID($component->evaluateExpression($properties['skinid'][1]));
+ else
+ $component->setSkinID($properties['skinid']);
+ unset($properties['skinid']);
}
$component->applyStyleSheetSkin($page);
// apply attributes
- foreach($object[2] as $name=>$value)
+ foreach($properties as $name=>$value)
$this->configureControl($component,$name,$value);
$component->createdOnTemplate($parent);
}
else if($component instanceof TComponent)
{
- if(isset($object[2]['id']))
+ if(isset($properties['id']))
{
- $tplControl->registerObject($object[2]['id'],$component);
+ if(is_array($properties['id']))
+ $properties['id']=$component->evaluateExpression($properties['id'][1]);
+ $tplControl->registerObject($properties['id'],$component);
if(!$component->hasProperty('id'))
- unset($object[2]['id']);
+ unset($properties['id']);
}
- foreach($object[2] as $name=>$value)
+ foreach($properties as $name=>$value)
$this->configureComponent($component,$name,$value);
$parent->addParsedObject($component);
}
@@ -714,7 +724,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
else
throw new TConfigurationException('template_property_unknown',$type,$name);
}
- else if(!is_string($att))
+ else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
{
if(strcasecmp($name,'id')===0)
throw new TConfigurationException('template_controlid_invalid',$type);