本文整理汇总了PHP中Zend_Config_Xml::setExtend方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Xml::setExtend方法的具体用法?PHP Zend_Config_Xml::setExtend怎么用?PHP Zend_Config_Xml::setExtend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Xml
的用法示例。
在下文中一共展示了Zend_Config_Xml::setExtend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAction
public function saveAction()
{
$this->_helper->layout()->setLayout("nolayout");
$modelname = $this->_request->getParam("model", 'Eau_Model_Company');
$suffixname = "model-config.xml";
$modelnameAr = explode("_", $modelname);
$packet = strtolower($modelnameAr[0]);
$configfile = $packet . "-" . $suffixname;
$config = new Zend_Config_Xml(CONFIG_PATH . "{$configfile}", null, true);
$allfield = array();
$arrayKey = array();
$i = 0;
foreach (App_Model_Config::get($modelname)->getProperties() as $element) {
$allfield[] = $element->name;
$arrayKey[$element->name] = $i++;
}
$config->production->classes->{$modelname}->text = "2";
$props = $config->production->classes->{$modelname}->prop->toArray();
foreach ($_POST as $key => $value) {
list($field, $property) = explode("_", $key);
if (in_array($field, $allfield)) {
$index = $arrayKey[$field];
foreach ($props as $key => $prop) {
if ($prop['name'] == $field) {
$props[$key][$property] = $value;
//$config->classes->{$modelname}->props->$field->$property = $value;
}
//echo $prop->name,"<br/>";
}
//$config->classes->{$modelname}->prop->$property = $value;
}
}
$config->production->classes->{$modelname}->prop = $props;
$config->staging = array();
$config->setExtend('staging', 'production');
$config->development = array();
$config->setExtend('development', 'production');
$writer = new Zend_Config_Writer_Xml();
$writer->write(CONFIG_PATH . $configfile, $config);
$this->render('blank', null, true);
}