打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
The New Framework Architecture (Part One: Sit...

This is the first of a multi-part series documenting the new framework architecture of osCommerce Online Merchant v3.0.

Those that have not been following the development of the new framework will receive quite a shock when they download the osCommerce Online Merchant v3.0 release package and start inspecting its source code. The new OO/MVC design approach will be completey foreign to those accustomed to the procedural style design v2.2 was based on. This is a new ballpark to play in, and it’s open for everyone to participate!

The first difference that will be seen is the new file and directory structure of the framework, specifically how clean it is. What’s provided is:

  • index.php
  • public/
  • osCommerce/

That’s it! The index.php file initiates the framework and the public directory holds site and template related images, stylesheets, javascript, and other assets that must be publicly available. The osCommerce directory is where the source code of the framework resides and is recommended to move to a PHP include directory that is outside of the public html directory serving the website.

The framework is initialized by the main OSCOM controller located at osCommerce/OM/Core/OSCOM.php. It’s main responsibility is to automatically load Sites, Applications, and Actions depending on the request URL.

Sites? Applications? Actions?

These are new modular sections of the framework that build the website. Correction, that build websites. The basis of the framework is flexible to support different kinds of websites, for example, a website content management system, a blog, a forum, etc., and with your help, will be improved on in future releases to support the building of such sites even easier. Our primary focus will remain on e-commerce - we can’t wait to see what the community builds in addition!

osCommerce Online Merchant v3.0 is built with the following four Sites:

  • Shop
  • Admin
  • RPC
  • Setup

The Shop Site is the frontend of the shop, the Admin Site is the administrative backend to the shop, the RPC Site manages JSON requests, and the Setup Site installs and configures new installations.

The first part of the request URL loads the specific Site. For example, the Shop Site would be loaded with the following URL:

http://demo.oscommerce.com/index.php?Shop

Sites are formed by areas packaged as Applications. The Shop Site includes the Account, Checkout, and Products Applications, and are loaded by the second part of the request URL:

http://demo.oscommerce.com/index.php?Shop&Account

Applications define the default page content to load and can be fine-tuned with Actions. Actions override the default loading page and can execute certain functionality that is loaded by the third part of the request URL. The log in page, which is part of the Account Application, can be loaded with the following URL:

http://demo.oscommerce.com/index.php?Shop&Account&LogIn

Actions are recursive - the processing of the log in page is performed by the following URL:

http://demo.oscommerce.com/index.php?Shop&Account&LogIn&Process

This allows new Sites, Applications, and Actions to be copied to the framework directory which work immediately without the need to edit core source code files.

The controllers loaded for the above examples are defined in the following file and directory structure:

osCommerce/OM/Core/Site/Shop/Controller.phposCommerce/OM/Core/Site/Shop/Application/Account/Controller.phposCommerce/OM/Core/Site/Shop/Application/Account/Action/LogIn.phposCommerce/OM/Core/Site/Shop/Application/Account/Action/LogIn/Process.php

Sites and Applications are self contained. Its required classes are located in its Site and Application directories, and are accessible by other Sites and Applications.

A default Site is defined in the configuration to load for requested Sites that do not exist, and to shorten the URLs used within the default Site. The default Site for new installations is Shop allowing for the following shortened URL:

http://demo.oscommerce.com/index.php?Account&LogIn

This works only for Sites and Applications that do not share the same names. For example, the above URL would load the Account Application and LogIn Action from the Shop Site if no Account Site exists. If an Account Site exists, it would be loaded instead with its LogIn Application.

Custom modifications to the framework must be performed in the following directory:

osCommerce/OM/Custom/

This directory is empty for new installations and follows the same file and directory structure as the osCommerce/OM/Core/ directory. Before files are loaded from the Core directory, a check is performed to see if a matching named file exists in the Custom directory to load instead. This allows for any part of the core framework to be overridden and for the core framework to be easily updated to newer releases without losing custom modifications.

Stay tuned for The New Framework Architecture (Part Two: Namespaces)

(Source: countdown.oscommerce.com)

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
play framework学习笔记之yml
Framework 和 Architecture 有何不同?
Clustering and Load Balancing in Tomcat 5, Part 2
架构(Architecture)和框架(Framework)杂谈
The Next Generation of Apache Hadoop MapReduc...
Application deployment using Microservice and Docker containers: Framework and optimization
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服