Magento 架构(Architecture)

piaoling  2011-05-12 13:27:04

本节介绍Magento的架构,包括

1).请求响应流程图

2).magento各模块间的依赖关系

3).Magento数据库设计

 

一。Magento系统请求响应流程图

page-request-flow

 
下面是具体请求步骤分析

  1. 用户向浏览器发出请求(高级话题:What really happens when you navigate to a URL)
  2. 浏览器向magento所在的服务器发出请求,magento的Controllers捕捉该请求并分发(实例:Magento Controller Dispatch and Hello World)
  3. Controller使用Oject Models,此时Magento的Model开始config(加载config.xml,system.xml,layout下的*.xml 等所有配置文件)(高级话题:config.xml 配置参数说明http://www.magentocommerce.com/wiki/development/reference/module_config.xml 和 system.xml 实例 http://alanstorm.com/custom_magento_system_configuration)
  4. Object Model 返回相应的数据(大部分是系统配置信息请研究Class Mage_Core_Model_Config和相关的类)
  5. Controller 根据layout下的*.xml的配置信息使用相应的Layouts
  6. Layout 使用Blocks(Blocks是Layout的骨架)
  7. Blocks使用Object Model(哈哈,这步是天经地义的,不通过Model使用数据库等相关的资源,Blocks就是巧妇难为无米之炊)
  8. Object Model 使用数据库资源(就是使用具体tables的数据,高级话题:http://www.magentocommerce.com/wiki/development/magento_database_diagram)
  9. 使用DB
  10. 返回DB资源
  11. 返回Datas给Object(主意Magento的Datas被加工成Object了)
  12. 返回datas对应的Object给Block
  13. Block使用Helpers(哈哈,Helpers其实就是打杂的,正如其名,作用完成一些特定的功能:更多Helpers参看:Mage_Core_Helper_Abstract 这是个高级话题,在system.xml配置的时候必须指定Helper)
  14. Helpers使用Object Models资源(Helpers打杂的最终目的-搞点东西回来)
  15. Object返回Helpers请求的资源
  16. Helpers return HTML(哈哈,Helpers打杂主要就是处理一些HTML相关的东西)给Blocks
  17. Blocks使用Templates(不适用Template怎么把内容显示出来,这步也天经地义,没必要解释)
  18. Templates使用Helpers(Helpers有时需要配合一下Templates,如Helpers用于控制图像的显示等功能)
  19. Helpers 返回HTML或者data给Template
  20. Template返回HTML给Blocks(block其实就是页面的一部分自定义的区域)
  21. 返回HTML
  22. 返回HTML
  23. Controller使用Helpers(主要处理URLs相关的东西)
  24. ........下面就不用解释了,不懂得google一下,留言给我也行,需要了解更多的magento资源请加入
  25. Magentor 开发者群正在招募贤士,欢迎参与。

 

二。Magento模块依赖关系图

 

package-dependence

 

模块之间的依赖没什么内容好说的,关键就是Mage_Core,还有非常重要的一点就是,参照上图来研究Magento Database 效率蛮高的。

 

 

三。Magento数据库设计

 

magento-database

 

由于Magento版本的问题上面的数据库图标对有相应的更新,请大家主意

提示:Magento Database Diagrams PDF下载

原创作品地址:http://yanggaojiao.iteye.com/

类别 :  magento(258)  |  浏览(3273)  |  评论(0)
发表评论(评论将通过邮件发给作者):

Email: