API/Core

From aMember Pro Documentation
Revision as of 06:42, 28 June 2011 by Alex (talk | contribs)
Jump to: navigation, search

aMember Pro v.4 is based on Zend Framework's Zend_Controller and follow its guidelines. There is a Bootstrap class that handles all the dependencies and configuration loading.

To get all aMember Pro functions available for your custom script, just include bootstrap.php withing amember/ folder. It does not output any page, just initialises the core.

aMember Pro uses .htaccess file in root folder to route requests to pages. It is done by using of Apache's mod_rewrite by redirecting all requests for not-image files to amember/index.php . index.php runs Zend_Controller_Front routing procedures to include necessary controller class and run it.


Directory layout

amember
  application
    configs/              - configuration files
    default/              - default module
      controllers/        - controller files - it replaces usual PHP "pages". One controller usually represents one "traditional" PHP file
      language/           - translations
      models/             - models : each file represents one database table. Contains successors to Am_Table and Am_Record classes
      plugins/            
        protect/          - integration plugins
        payment/          - payment plugins
        misc/             - misc. plugins, for example google analytics integration plugin
      themes/             - user-side themes
      themes-admin/       - admin-side themes
      views/              - templates, it is better to modify templates by creation of custom theme
      Bootstrap.php       - module bootstrap file
      db.xml              - database structure configuration file
    newsletter/           - a "newsletter" module. Described here for example
      controllers/        - newsletter module controllers. Accessible like http://www.example.com/am4/newsletter/subscribe
      library/            - newsletter module model classes and other libraries
      views/              - Zend_View templates for newsletter module. All "views" folders are merged to single view path, and module can provide its own version of existing templates
        blocks/           - template "blocks" - small page pieces that can be included/excluded/shuffled via API
  data
    cache/                - cache files
    new-rewrite/          - new-rewrite marker files
  library                 - amember and third-party core libraries
  setup/                  - setup folder
  bootstrap.php           - initialize amember core
  index.php               - runs page controller and outputs content
  js.php                  - accelerator to pack all necessary JS libs to one file and deliver to client
  public.php              - accelerator to provide quick access to custom files, specially configurable CSS files in themes