Modular Framework
By Phillip Long • Posted: March 10, 2009 • Applications & ComponentsThis application is a centralized framework designed to support other applications, and it forms the backbone of the majority of the sites we build. It takes full advantage of PHP's object-oriented design capabilities, and is built in such a way that it can support pretty much any application we can think of with minimal to no modification.
Its primary function is to provide a single point-of-access for all database functions, allowing all applications in the site to run queries without directly calling mysql_query(), and without sharing database credentials in global variables. In addition to improving security, this approach allows this system and any extensions to readily be adapted to database engines other than MySQL, a concept that has been successfully tested by porting an entire complex site to MS SQL with only four lines of code changed.
The other main feature of this system is to provide security features. Since it's the first thing to load, it performs user authentication checks, maintains the security log/ban system, and can check whether a user has access to the current page. Additional files included in the "core" of the site handle login/logout procedures, user registration, account editing, and administrative functions.
Another feature of this system is to handle generation of all global content at the top and bottom of every page in the site. When properly combined with a table-less layout, this allows the framework to handle everything that a templating engine would with maximum efficiency and minimal redundant code. When used with static content, a webpage can contain only the basic text of the content, and still display a rich, full-featured layout with the inclusion of only a single line of PHP code. This allows the system to be used for sites that will be maintained by the site's owner without installing a CMS. In fact, if the system is modified to function without its user/security components (trivial to do, due to its modular design and minimal dependancies), it can fulfill the essential purpose of a CMS (allowing users with minimal to no web design experience to maintain a rich, well-built site) without requiring a database at all.
Additional features and scripts are included to streamline the deployment of sites using the system, including centralized cookie set/retrieve functions (allows any cookies to be renamed for any site, without altering code outside config variables), generation time/query counter for debugging and performance checking, and color scheme changes (excellent for accessibility features). Also, for sites that use multiple domains or subdomains, the system can adjust cookie settings, themes, languages, content, or anything else the client needs, allowing a site to readily be adapted for different regions, countries, or purposes with minimal adaptation of the main application code.
Examples
This component is integrated into these projects:





