TomatoCMS in A Nutshell


Published on

Explain TomatoCMS in deep detail

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

TomatoCMS in A Nutshell

  1. 1. TomatoCMS in A Nutshell
  2. 2. Table of Content <ul><li>TomatoCMS : Background </li></ul><ul><li>TomatoCMS : Architecture </li></ul><ul><li>TomatoCMS : System Design </li></ul><ul><li>TomatoCMS : Components </li></ul><ul><li>TomatoCMS : Features (Current & New) </li></ul>
  3. 3. TomatoCMS : Background
  4. 4. Pre-Requisition <ul><li>PHP 5.2 or higher </li></ul><ul><li>(PHP 5.2 is able to use but need to modify index.php) </li></ul><ul><li>MySQL server 5.0 or higher </li></ul><ul><li>(Default/Recommend) </li></ul><ul><li>Background Knowledge </li></ul><ul><ul><li>Zend Framework – Not required </li></ul></ul><ul><ul><li>jQuery – Should be </li></ul></ul><ul><ul><li>MVC/OOP – Strong required </li></ul></ul><ul><ul><li>PHP – Just familiar with web developer is OK </li></ul></ul><ul><ul><li>Familiar with any CMS </li></ul></ul><ul><ul><li>(ASP.NET or PHP) </li></ul></ul>
  5. 5. TomatoCMS Overview <ul><li>A content management system based-on </li></ul><ul><li>OS Independents </li></ul><ul><li>Cross-Platforms </li></ul><ul><li>Multiple DBs </li></ul><ul><li>Web Server (with mod_rewrite) </li></ul> Not support on IE6.0
  6. 6. The concept is … <ul><li>Problem: Here is what we want to have on website </li></ul>
  7. 7. The concept is … <ul><li>Imagine how it can be created </li></ul>
  8. 8. The concept is … <ul><li>How to define the width of container / widget? </li></ul><ul><li>=> use 960 Grid System (12 columns) </li></ul>
  9. 9. The concept is … <ul><li>How to define the layout? </li></ul><ul><li>Construct the nested containers … </li></ul>
  10. 10. The concept … <ul><li>How to define the layout? </li></ul><ul><li>… and widget </li></ul>
  11. 11. We made it because … <ul><li>How to manage layout? </li></ul><ul><li>Edit the layout file (XML file) manually </li></ul><ul><li>Visual Layout Editor: drag, drop, configure, preview </li></ul><ul><li>Demonstration </li></ul><ul><li>Live-demo </li></ul><ul><li>You get the idea !!! </li></ul><ul><li>1 page = n * containers </li></ul><ul><li>1 container = n * containers + m * widgets </li></ul>
  12. 12. TomatoCMS : Architecture
  13. 13. TomatoCMS : Stack View Tomato Core Module Standard Modules 3rd Party Modules 3 rd Party CSSTidy HTML Purifier JSMin PclZip ZFDebug Tomato Library Tomato_Autoloader Tomato_Config Tomato_GlobalKey Tomato_Hook Tomato_Language Tomato_Layout Tomato_Widget Tomato_Zip Tomato_Cache
  14. 14. TomatoCMS : Layer View 3 rd Party Tomato Library Tomato Core Module Standard/3 rd Party Modules Extension/Add-on Web Application Framework General/Common Library Application Framework CSSTidy HTML Purifier JSMin PclZip ZFDebug Tomato_Autoloader Tomato_Config Tomato_GlobalKey Tomato_Hook Tomato_Language Tomato_Layout Tomato_Widget Tomato_Zip Tomato_Cache
  15. 15. TomatoCMS : Stack View <ul><li>3 rd Party Library </li></ul><ul><ul><li>Zend Framework 1.0 </li></ul></ul><ul><ul><ul><li>It’s ASP.NET3.5 Clone </li></ul></ul></ul><ul><ul><li>CSSTidy </li></ul></ul><ul><ul><ul><li>allow CSS Parser and Optimizer </li></ul></ul></ul><ul><ul><li>HTML Purifier 4.1.0 </li></ul></ul><ul><ul><ul><li>Standards Compliant HTML Filtering </li></ul></ul></ul><ul><ul><li>JSMin </li></ul></ul><ul><ul><ul><li>Compress JavaScript for PHP </li></ul></ul></ul><ul><ul><li>PclZip </li></ul></ul><ul><ul><ul><li>PHP library that manage ZIP archives </li></ul></ul></ul><ul><ul><li>ZFDebug </li></ul></ul><ul><ul><ul><li>Debugging code in Zend Framework </li></ul></ul></ul>
  16. 16. TomatoCMS : Stack View <ul><li>Tomato Library </li></ul><ul><ul><li>Tomato_Autoloader: inherit from Zend_Loader_Autoloader_Resource </li></ul></ul><ul><ul><li>Tomato_Cache: manage Cache for Front-end & Back-end </li></ul></ul><ul><ul><li>Tomato_Config: read/manage configuration file </li></ul></ul><ul><ul><li>Tomato_GlobalKey: HTTP logging </li></ul></ul><ul><ul><li>Tomato_Hook: based class for Hook components </li></ul></ul><ul><ul><li>Tomato_Language: Manage language packs for each module/widget </li></ul></ul><ul><ul><li>Tomato_Layout: Manage layout for front-end </li></ul></ul><ul><ul><li>Tomato_Widget: Widget abstract class for manage Widget componts </li></ul></ul><ul><ul><li>Tomato_Version: Version of TomatoCMS (stable is 2.0.8) </li></ul></ul><ul><ul><li>Tomato_Zip: Zip file management (refer to PclZip) </li></ul></ul>
  17. 17. TomatoCMS : Stack View <ul><li>Tomato Core Module: Handle & management TomatoCMS </li></ul><ul><ul><li>Core Action : Behind the scene </li></ul></ul><ul><ul><ul><li>Authentication </li></ul></ul></ul><ul><ul><ul><li>Cache </li></ul></ul></ul><ul><ul><ul><li>Config </li></ul></ul></ul><ul><ul><ul><li>Hook </li></ul></ul></ul><ul><ul><ul><li>Locale </li></ul></ul></ul><ul><ul><li>Bundle Feature : Support in back-end & Front-end </li></ul></ul><ul><ul><ul><li>Dashboard </li></ul></ul></ul><ul><ul><ul><li>Language </li></ul></ul></ul><ul><ul><ul><li>Log </li></ul></ul></ul><ul><ul><ul><li>Message </li></ul></ul></ul><ul><ul><ul><li>Module </li></ul></ul></ul><ul><ul><ul><li>Page </li></ul></ul></ul><ul><ul><ul><li>Permalink </li></ul></ul></ul><ul><ul><ul><li>Plugin </li></ul></ul></ul><ul><ul><ul><li>Privillege </li></ul></ul></ul><ul><ul><ul><li>Resource </li></ul></ul></ul><ul><ul><ul><li>Role </li></ul></ul></ul><ul><ul><ul><li>Rule </li></ul></ul></ul><ul><ul><ul><li>Target </li></ul></ul></ul><ul><ul><ul><li>Template ** </li></ul></ul></ul><ul><ul><ul><li>User </li></ul></ul></ul><ul><ul><ul><li>Widget </li></ul></ul></ul>
  18. 18. TomatoCMS : Components <ul><li>Modules </li></ul><ul><ul><li>Set of codes/container of components (i.e. widgets & hooks) </li></ul></ul><ul><ul><li>Inside modules </li></ul></ul><ul><ul><ul><li>Routing </li></ul></ul></ul><ul><ul><ul><li>Languages </li></ul></ul></ul><ul><ul><ul><li>Model ~ View ~ Controller </li></ul></ul></ul><ul><ul><ul><li>Widgets </li></ul></ul></ul><ul><ul><ul><li>Plug-in </li></ul></ul></ul><ul><ul><ul><li>Hook ** </li></ul></ul></ul><ul><ul><ul><li>Services ** </li></ul></ul></ul><ul><li>Widgets </li></ul><ul><ul><li>Snip code for some interaction with user (e.g. display feed) </li></ul></ul><ul><ul><li>Inside widgets </li></ul></ul><ul><ul><ul><li>Languages </li></ul></ul></ul><ul><ul><ul><li>View ~ Model (rare) </li></ul></ul></ul>
  19. 19. TomatoCMS : Components (2) <ul><li>Plugin </li></ul><ul><ul><li>Set of codes that work on “ Pre-Dispatch ” or “ Post-Dispatch ” </li></ul></ul><ul><ul><li>2 Levels access: - </li></ul></ul><ul><ul><ul><li>Global (not belong to any modules) </li></ul></ul></ul><ul><ul><ul><li>Module (depended on module) </li></ul></ul></ul><ul><li>Hook </li></ul><ul><ul><li>Set of codes that work during “ Pre-Dispatch ” and “ Post-Dispatch ” </li></ul></ul><ul><ul><li>2 Levels access: - </li></ul></ul><ul><ul><ul><li>Global (not belong to any modules) </li></ul></ul></ul><ul><ul><ul><li>Module (depended on module) </li></ul></ul></ul> Plugin & Hook can’t access the DB layer
  20. 20. TomatoCMS : Naming <ul><li>File & Class Naming: General Concept </li></ul><ul><ul><li>File Name : “ CamelCase ” with the first letter capitalized. </li></ul></ul><ul><ul><li>Class Name : Mixed folder/sub-folder and separate by “_” (Underscore) </li></ul></ul><ul><ul><li>Apply to all components/libraries in TomatoCMS </li></ul></ul><ul><li>Components Naming : “module” level </li></ul><ul><ul><li>Class naming : <Module Name>_<Sub Module>_<Class Name> </li></ul></ul><ul><ul><li>File Name: application <Module Name><Sub Module><Class Name>.php </li></ul></ul><ul><li>Components Naming : Global level </li></ul><ul><ul><li>Class naming : <Component Type>_<Object Name>_<Type Name> </li></ul></ul><ul><ul><li>File Name: application <Component Type><Object Name><Type Name>.php </li></ul></ul><ul><ul><li>Apply on : Hooks, Plug-ins </li></ul></ul>
  21. 21. TomatoCMS : Naming <ul><li>TomatoCMS Libraries ( librariesTomato) </li></ul><ul><ul><li>Start with “ Tomato_ ” and no need to inherit from any class </li></ul></ul><ul><ul><li>Format: “ Tomato_<Folder>_<Sub-Folder>_<Class Name> ” </li></ul></ul><ul><ul><ul><li>e.g. Tomato_Cache_File  librariesTomatoCacheFile.php </li></ul></ul></ul><ul><ul><li>Auto-loading when required to use </li></ul></ul><ul><li>TomatoCMS Global Hooks ( applicationhooks) </li></ul><ul><ul><li>Format: “ Hooks_<Hook Name>_Hook ” </li></ul></ul><ul><ul><ul><li>e.g. Hooks_BadWordsCensor_Hook  applicationhooksbadwordscensorHook.php </li></ul></ul></ul><ul><li>TomatoCMS Global Plugin ( applicationplugins) </li></ul><ul><ul><li>Format: “ Plugins_<Plugin Name>_Plugin ” </li></ul></ul><ul><ul><ul><li>e.g. Plugins_AdminAccess_Plugin  applicationpluginAdminAccessPlugin.php </li></ul></ul></ul>
  22. 22. TomatoCMS : Naming <ul><li>TomatoCMS Components ( applicationmodules) </li></ul><ul><ul><li>Basic Idea: </li></ul></ul><ul><ul><ul><li>Class Name : <Module Name>_<Sub-Folder Name>_<Resource Name> </li></ul></ul></ul><ul><ul><ul><li>File Name : appliationmodules <Module Name><Sub-Folder Name><Resource Name>.php </li></ul></ul></ul><ul><ul><li>Controller: <Module Name>_<Resource Name>Controller </li></ul></ul><ul><ul><ul><li>e.g. Ad_BannerController  applicationmodulesadcontrollersBannerController.php </li></ul></ul></ul><ul><ul><ul><li>Must extended from “ Zend_Controller_Action ” </li></ul></ul></ul><ul><ul><li>Others  Follow above rule </li></ul></ul><ul><ul><ul><li>Models ~ DAO ~ Interface </li></ul></ul></ul><ul><ul><ul><li>Services </li></ul></ul></ul><ul><ul><ul><li>Widgets </li></ul></ul></ul>
  23. 23. TomatoCMS : Folder Structure v2.0.5  Remove in v.2.1.0 In application folder before! v2.0.6 v2.0.7 v2.0.8 (Stable) v2.0.9 v2.1.0 (Beta) application config hooks modules core ** module plugins templates js libraries skins ZF Tomato 3 rd Party config hooks modules core ** module plugins templates js libraries skins ZF Tomato 3 rd Party
  24. 24. TomatoCMS : Why Change? <ul><li>Easy to add 3 rd party files on each module e.g. </li></ul><ul><ul><li>CSS </li></ul></ul><ul><ul><li>JavaScript </li></ul></ul><ul><li>Access resources (modules/widgets) via URL </li></ul><ul><ul><li>e.g. the thumbnails of modules/widgets </li></ul></ul><ul><li>Change Model layer: “Fat Model, thin Controller” principle </li></ul><ul><ul><li>Easy to do unit-testing </li></ul></ul><ul><ul><li>Able to perform other actions e.g. cache data, validate input, integrate Zend_Form (in the future), etc. </li></ul></ul> Refer to :
  25. 25. TomatoCMS : System Design
  26. 26. TomatoCMS : System Design <ul><li>System Overview </li></ul><ul><li>Understand Zend Framework (ZF) MVC </li></ul><ul><li>ZF Implementation in TomatoCMS </li></ul><ul><li>TomatoCMS: Data Access Layer (DAL) </li></ul><ul><li>TomatoCMS: Model vs DAL </li></ul>
  27. 27. System Overview Request TomotoCMS Index.php Bootstrap.php Load Controller Response Render View Load Initialize everything Load Data Object Call Access
  28. 28. Understand ZF MVC <ul><li>M-V-C in Zend Framework </li></ul><ul><li>ZF MVC : Structure </li></ul><ul><li>ZF MVC : Behavior </li></ul><ul><li>ZF MVC : Flow </li></ul>
  29. 29. M-V-C in ZF <ul><li>Zend_M…? </li></ul><ul><ul><li>Model s can be very different : DB, Web-Services, Feeds, … etc. </li></ul></ul><ul><ul><li>For example: - </li></ul></ul><ul><ul><ul><li>Zend_Db ( Adaptor Pattern ) </li></ul></ul></ul><ul><ul><ul><li>Zend_Service </li></ul></ul></ul><ul><ul><ul><li>Zend_Feed </li></ul></ul></ul><ul><ul><ul><li>Etc. </li></ul></ul></ul><ul><li>Zend_Controller </li></ul><ul><ul><li>Front Controller pattern </li></ul></ul><ul><ul><li>Zend_Controller_Action </li></ul></ul><ul><ul><ul><li>action methods correspond to various actions you wish the controller to be handle </li></ul></ul></ul><ul><li>Zend_View </li></ul><ul><ul><li>template system agnostic </li></ul></ul><ul><ul><li>Zend_Layout: implement “ Two Steps View ” pattern </li></ul></ul>Refer to:
  30. 30. ZF MVC : Structure Zend_Application Zend_Controller_Front Zend_Db_Table_Abstract Zend_Controller_Action Zend_View
  31. 31. ZF MVC : Behavior Request dispatch() route() dispatch() action1Action() render() action1.php Response Client
  32. 32. ZF MVC : Flow <ul><li>The basic Zend Framework workflow of handling a request is fairly simple. </li></ul>Refer to:
  33. 33. ZF MVC : Flow (Cont’) <ul><li>First the Request is ‘captured’ and a </li></ul><ul><li>Request Object is made. </li></ul><ul><li>The Request Object is just a </li></ul><ul><li>representation of the Request itself. </li></ul><ul><li>By default the HTTP Request Object is </li></ul><ul><li>used. It holds attributes like the URL </li></ul><ul><li>and parameters. </li></ul>
  34. 34. ZF MVC : Flow (Cont’) Secondly the Router is called. The Router checks the Request Object, and alters it depending on registered Routes. By default the Rewrite Router is used. This Router sets the controller, action and parameters from the URL.
  35. 35. ZF MVC : Flow (Cont’) After the Routing is done, the Dispatch Loop is started. The Dispatch Loop is performed until the status of the Request Object is set to ‘dispatched’.
  36. 36. ZF MVC : Flow (Cont’) The default Dispatcher is the Standard Dispatcher. This Dispatcher defines controllers as UpperCamelCase classes that end with Controller, and derfines actions as lowerCamelCase methods ending with Action. FooController::barAction()
  37. 37. ZF MVC : Flow (Cont’) Next, the Action Controller is called. This is the Controller that you have created yourself. Like this: /foo/bar FooController::barAction()
  38. 38. ZF MVC : Flow (Cont’) The Action Controller often implements a View. As the View is rendered, the output is added to the Response Object.
  39. 39. ZF MVC : Flow (Cont’) After the Action Controller has finished the Dispatcher Loop normally finishes. If the Action Controller resetted the Dispatched status of the Request Object, the Loop continues, and a new Dispatch is triggered. For instance you can forward to another Action.
  40. 40. ZF MVC : Flow (Cont’) At last the Response is sent back. By default the Response used is the http Response.
  41. 41. ZF Implementation in TomatoCMS <ul><li>MVC Structure </li></ul><ul><ul><li>Not use : Zend_Db_Table </li></ul></ul><ul><ul><li>Data Access : implement by Tomato Entity Class </li></ul></ul><ul><li>MVC Behavior </li></ul><ul><ul><li>Same as standard ZF </li></ul></ul><ul><li>Bootstrap </li></ul><ul><ul><li>Initialize useful classes for TomatoCMS </li></ul></ul><ul><li>MVC Flow </li></ul><ul><ul><li>Same as standard ZF </li></ul></ul>
  42. 42. ZF MVC Structure : Implementation Not Used Zend_Application Zend_Controller_Front Zend_Db_Table_Abstract Zend_Controller_Action Zend_View
  43. 43. BootStrap : TomatoCMS Heart-beat Zend_Application_Bootstrap_Bootstrap Bootstrap
  44. 44. BootStrap : Methods <ul><li>_initAutoload() Method </li></ul><ul><ul><li>Register class name & auto-loading when required </li></ul></ul><ul><ul><li>See naming conversion : Auto-Loader will look-up Class/File conversion rule. </li></ul></ul><ul><li>_initRoutes() Method </li></ul><ul><ul><li>Avoiding standard routing in ZF </li></ul></ul><ul><ul><li>Routing: define in INI files under folder “ applicationmodules<Module Name>configroutes ” </li></ul></ul><ul><li>_initSession() Method </li></ul><ul><ul><li>Initialize session variables for store information </li></ul></ul><ul><ul><li>Doesn’t allow to access session variable directly. </li></ul></ul>
  45. 45. BootStrap : Methods (2) <ul><li>_initActionHelpers() method </li></ul><ul><ul><li>Extend “ Controllers action” automatically </li></ul></ul><ul><ul><li>Standard Action-Helper : CSRF protection </li></ul></ul><ul><ul><li>User-Defined Action-Helper: LibrariesTomatoControllerActionHelper </li></ul></ul><ul><li>_initPlugins() methods </li></ul><ul><ul><li>Extend “dispatcher” automatically </li></ul></ul><ul><ul><li>Standard Plug-in loaded when start TomatoCMS </li></ul></ul><ul><ul><ul><li>Core_Controllers_Plugin_Init() </li></ul></ul></ul><ul><ul><ul><li>Tomato_Controller_Plugin_Admin() </li></ul></ul></ul><ul><ul><ul><li>Tomato_Controller_Plugin_Template() </li></ul></ul></ul><ul><ul><ul><li>Core_Controllers_Plugin_HookLoader() </li></ul></ul></ul><ul><ul><ul><li>Core_Controllers_Plugin_Auth() </li></ul></ul></ul><ul><ul><ul><li>Core_Controllers_Plugin_Permalink() </li></ul></ul></ul><ul><ul><ul><li>Tomato_Controller_Plugin_LocalizationRoute() </li></ul></ul></ul><ul><ul><ul><li>Zend_Controller_Plugin_ErrorHandler() </li></ul></ul></ul>
  46. 46. TomatoCMS: DAL <ul><li>DAL = Data Access Layer </li></ul><ul><li>Avoiding “ Zend_Db_Table_Abstract ”  using “ Tomato_Db_Connection ” </li></ul><ul><li>Multiple support 3 kind of DBs </li></ul><ul><ul><li>MySQL (with PDO and without PDO) </li></ul></ul><ul><ul><li>MS-SQL (testing with 2005 & 2008) </li></ul></ul><ul><ul><li>PostgreSQL  Never tested </li></ul></ul>
  47. 47. TomatoCMS: DAL structure Tomato_Db_Connection Connection (PDO_MySQL) Connection (MySQL) Connection (PqSQL) Connection (MS-SQL) Tomato_Db_Connection_Abstract
  48. 48. TomatoCMS: DAL Architecture Tomato_Db_Connection getSlaveConnection() getMasterConnection() <ul><li>Purpose for Load-Balancing </li></ul><ul><li>Master & Slave : can be the same DB or different DB </li></ul>factory (contained $class of Tomato_Db_Connection_Abstract ) DB DB
  49. 49. TomatoCMS: Model vs DAO Tomato_Model_Entity Tomato_Model_Dao Tomato_Db_Connection MyModel
  50. 50. TomatoCMS: Model vs DAL <ul><li>Model </li></ul><ul><ul><li>Data encapsulation </li></ul></ul><ul><ul><li>Only Properties  for mapping table purpose </li></ul></ul><ul><li>DAL </li></ul><ul><ul><li>Contain Business Logic </li></ul></ul><ul><ul><li>Contain SQL native </li></ul></ul><ul><ul><li>1 Class = 1 DB type </li></ul></ul>
  51. 51. TomatoCMS: DAL Mechanism <ul><li>Model/DAO able to call from </li></ul><ul><li>Controller </li></ul><ul><li>Services (*) </li></ul>$conn = Tomato_Db_Connection::factory()->getMasterConnection(); $bannerDao = Tomato_Model_Dao_Factory::getInstance() ->setModule('ad') ->getBannerDao(); $bannerDao->setDbConnection($conn); … … $id = $bannerDao->add($banner); (*) Since 2.0.9, Controller won’t declare $conn/$Dao variables anymore. Services Object will handle this case $conn (Tomato_Db_Connection) DB $bannerDAO (Tomato_Model_Dao_Factory) setDBConnection (Load by adapter type)
  52. 52. TomatoCMS : Components
  53. 53. TomatoCMS : Components Type <ul><li>Module </li></ul><ul><ul><li>Services </li></ul></ul><ul><ul><li>Widgets </li></ul></ul><ul><ul><li>View-Helpers </li></ul></ul><ul><ul><li>Action-Helpers </li></ul></ul><ul><li>Plug-ins </li></ul><ul><li>Hooks </li></ul>
  54. 54. TomatoCMS: Components <ul><li>Original idea for components in TomatoCMS </li></ul><ul><ul><li>Able to install/Uninstall easier </li></ul></ul><ul><ul><ul><li>we’ve GUI for configuration : Module ~ Plug-in ~ Hooks ~ Widget </li></ul></ul></ul><ul><ul><li>Scalability </li></ul></ul><ul><ul><li>Modular system </li></ul></ul>
  55. 55. TomatoCMS: Module <ul><li>Set of codes/container of components </li></ul><ul><ul><li>Each module will not interface other modules </li></ul></ul><ul><ul><li>Each module able to access other modules </li></ul></ul><ul><ul><li>Each module able to depended on other modules </li></ul></ul><ul><ul><li>Following “Modular Design” Principle </li></ul></ul><ul><li>Inside modules </li></ul><ul><li>Routing : Mapping URL with Action in Controller </li></ul><ul><li>Languages : Multi-languages pack (e.g. EN, VN, TH, etc. </li></ul><ul><li>Model ~ View ~ Controller : Already explain in previous chapter </li></ul><ul><li>Widgets : Snip codes for interactive with user </li></ul><ul><li>Plug-in ~ Hook : Explain next section </li></ul><ul><li>Services : Independent class for re-used in module or between module </li></ul><ul><li>View-Helper: aka, User-Control (in ASP.NET)  reusable code for view/display </li></ul>
  56. 56. TomatoCMS: Module Structure For example: - “ Comments ” module <ul><li>/config/  contain XML files for identify module </li></ul><ul><li>/config/routes  defined routing (mapping URL with Controller’s action) </li></ul><ul><li>/controllers </li></ul><ul><li>/languages  contained language pack files (in INI) </li></ul><ul><li>/models </li></ul><ul><li>/views  contained html file for display on GUI </li></ul><ul><li>/views/helpers  contained view-helper code </li></ul><ul><li>/widgets  contained widget code/html for display </li></ul>
  57. 57. TomatoCMS: Module Configuration <ul><li>Easy for installation </li></ul><ul><li>Dependency requirements </li></ul><ul><li>Able to upload directly to server </li></ul>
  58. 58. TomatoCMS: Module’s Components <ul><li>Main Components  M~V~C objects </li></ul><ul><li>Optional Components </li></ul><ul><ul><li>Services </li></ul></ul><ul><ul><ul><li>e.g. get data from DB, calculation logic, business logic, etc. </li></ul></ul></ul><ul><ul><li>Widget </li></ul></ul><ul><ul><ul><li>Some widget can has their own DAO/model </li></ul></ul></ul><ul><ul><li>Plug-in/Hook </li></ul></ul><ul><ul><li>View Helper </li></ul></ul><ul><ul><ul><li>Same concept of “ User Control ” in ASP.NET </li></ul></ul></ul><ul><ul><ul><li>Able to share between module </li></ul></ul></ul><ul><ul><li>Action Helper </li></ul></ul><ul><ul><ul><li>Similar to “httpModule” in ASP.NET (2.0 or higher) </li></ul></ul></ul><ul><ul><ul><li>Work automatically when URL has request </li></ul></ul></ul>
  59. 59. TomatoCMS: Plug-In <ul><li>Work with “ Controller ” object </li></ul><ul><ul><li>Automatically work </li></ul></ul><ul><ul><li>Bootstrap has load some plug-ins to work </li></ul></ul><ul><ul><li>User able to defined plug-ins to load while start-up by add plug-in name in “ application.ini ” </li></ul></ul><ul><li>Work on 2 events type: - </li></ul><ul><ul><li>preDispatch </li></ul></ul><ul><ul><ul><li>e.g. Auth (in Core module) </li></ul></ul></ul><ul><ul><ul><li>Admin (in Tomato’s library) </li></ul></ul></ul><ul><ul><li>postDispatch </li></ul></ul><ul><ul><ul><li>Localization </li></ul></ul></ul><ul><ul><ul><li>ActionCache </li></ul></ul></ul>
  60. 60. TomatoCMS: Hook <ul><li>Hook </li></ul><ul><ul><li>Working between preDispatch() and postDispatch() </li></ul></ul><ul><ul><li>2 types of Hooks: - </li></ul></ul><ul><ul><ul><li>Filter </li></ul></ul></ul><ul><ul><ul><li>Action </li></ul></ul></ul><ul><li>Hook Target </li></ul><ul><ul><li>Declare in “controller” </li></ul></ul><ul><ul><li>Enabled “extra” flow to work </li></ul></ul>
  61. 61. TomatoCMS: Hook (Cont’) e.g. class “ Core_AuthController ” Has Hook? Execute Hook Other lines of code Hook Target
  62. 62. TomatoCMS: Hook Target Register “Hook” that related to the code