2011-1-4----mage_core_model_layout--construct方法--个人分析
来源:互联网 发布:ps机做淘宝主图多 编辑:程序博客网 时间:2024/05/18 03:27
/**
* Class constructor
*
* @param array $data
*/
public function __construct($data=array())
{
$this->_elementClass = Mage::getConfig()->getModelClassName('core/layout_element');
$this->setXml(simplexml_load_string('<layout/>', $this->_elementClass));
$this->_update = Mage::getModel('core/layout_update');
parent::__construct($data);
}
1
$this->_elementClass = Mage::getConfig()->getModelClassName('core/layout_element');
/**
* Retrieve modele class name
*
* @param sting $modelClass
* @return string
*/
public function getModelClassName($modelClass)
{
$modelClass = trim($modelClass);
if (strpos($modelClass, '/')===false) {
return $modelClass;
}
return $this->getGroupedClassName('model', $modelClass);
}
1.1
//去掉空格
function trim ($str, $charlist = null) {}
1.2
//Find position of first occurrence of a string
function strpos ($haystack, $needle, $offset = null) {}
1.3
$this->getGroupedClassName('model', $modelClass);
/**
* Retrieve class name by class group
*
* @param string $groupType currently supported model, block, helper
* @param string $classId slash separated class identifier, ex. group/class
* @param string $groupRootNode optional config path for group config
* @return string
*/
public function getGroupedClassName($groupType, $classId, $groupRootNode=null)
{
if (empty($groupRootNode)) {
$groupRootNode = 'global/'.$groupType.'s';
}
$classArr = explode('/', trim($classId));
$group = $classArr[0];
$class = !empty($classArr[1]) ? $classArr[1] : null;
if (isset($this->_classNameCache[$groupRootNode][$group][$class])) {
return $this->_classNameCache[$groupRootNode][$group][$class];
}
//$config = $this->getNode($groupRootNode.'/'.$group);
$config = $this->_xml->global->{$groupType.'s'}->{$group};
if (isset($config->rewrite->$class)) {
$className = (string)$config->rewrite->$class;
} else {
if (!empty($config)) {
$className = $config->getClassName();
}
if (empty($className)) {
$className = 'mage_'.$group.'_'.$groupType;
}
if (!empty($class)) {
$className .= '_'.$class;
}
$className = uc_words($className);
}
$this->_classNameCache[$groupRootNode][$group][$class] = $className;
return $className;
}
2
//加载xml
parent::__construct($data);
//总体作用是加载xml文件。
- 2011-1-4----mage_core_model_layout--construct方法--个人分析
- 2011-1-4-----核心模型---mage_core_model_cache---construct方法--个人分析
- 2010-1-3------mage_core_model_config------------construct过程----------------个人分析
- 2011-1-3----mage_core_model_config---------init()方法加载过程---个人分析
- 个人分析
- 个人分析
- construct
- 【个人笔记三】ART系统类和方法加载分析
- 【个人笔记四】ART系统执行类方法流程分析
- 【Project construct】Hello World项目结构分析
- dojo/dom-construct的create方法
- 仪器分析系统个人心得(1)
- 个人工作状态分析
- 个人性格分析
- 买鸡卖鸡问题个人分析
- 文本分析个人理解
- Volley源码个人分析
- FragmentManager分析(个人笔记)
- thinking in qt
- 事件弹出窗口
- 锦瑟
- 桌面右下角出现“Windows 7 内部版本 7600 此Windows副本不是正版”
- 2011-1-4-----核心模型---mage_core_model_cache---construct方法--个人分析
- 2011-1-4----mage_core_model_layout--construct方法--个人分析
- 修改.htaccess实现301重定向
- 学做程序经理--转
- python3.1+pyqt4.8.1+eric5开发一个简单记事本程序
- 位图缓存优化渲染研究1
- 浏览器事件
- Bad Coder
- 【Android游戏开发十三】(保存游戏数据 [下文])详解SQLite存储方式,并把SQLite的数据库文件存储在SD卡中!!!
- 关于Flash CS5 自己编写组件的教程