Zend Framework

Preview Release 0.1.5

This is an installation of the Zend Framework Preview 0.1.5. You may clone this application by clicking on the "Get Your Own!" button at the top of this page to use the Zend Framework for your Ning application. Please note, this has been specially modified to run on Ning. In short, this means the following:

  • All references to $_SERVER['REQUEST_URI'] were changed to $_SERVER['HTTP_X_NING_REQUEST_URI']. This is because the request URI in Ning actually contains the mapped URI instead of the URI before the mapping occurs, but HTTP_X_NING_REQUEST_URI contains the URI as it appears before the mapping, which is what the Zend Framework expects.

    The changes made occurred at the following locations:
    lib/Zend/Cache/Frontend/Page.php:139:REQUEST_URI
    lib/Zend/Controller/RewriteRouter.php:64:REQUEST_URI
    lib/Zend/Controller/RewriteRouter.php:105:REQUEST_URI
    lib/Zend/Controller/Router.php:54:REQUEST_URI
    
  • The Zend Framework currently requires URL rewriting generally provided by Apache's mod_rewrite module, which can usually be accessed through the use of .htaccess files in your website's webroot directory. Ning does not allow the use of .htaccess files. Thus, it was necessary to modify the Ning URL mappings to achieve the desired effect.

    The following mappings were set up:
    /x(.*)                             =>  /x$1        (ensures that Ning helper applications at /xn are accessible)
    /(.*)\.(js|ico|gif|jpg|png|css)    =>  /$1.$2      (ensures that requests for these files aren't sent to index.php)
    /(.*)                              =>  /index.php  (sends all other requests through index.php)
    
  • An index.php bootstrap file and application structure (described below) are included with this installation to get you started with the Zend Framework quickly.
  • The PHP include_path was modified in index.php to include the lib/ folder, which includes the Zend Framework and any other library files you wish to include.
    ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/lib');
    
  • Click here to test the set-up of the application by accessing the indexAction() method of the HelloController class.

Other Important Details

  • The Zend Framework Preview Release 0.1.5 requires PHP 5.1.4. However, Ning uses PHP 5.0.4. It is unclear at this point what parts of the Zend Framework may fail to work on Ning. You use this application at your own risk.
  • Ning does not contain any relational database systems. That is, you cannot build a MySQL or PostgreSQL database on Ning. This does not mean that you cannot connect to a remote database using the Zend Framework, though. However, you are encouraged to use the Ning Content Store instead. Use the Zend Framework as your controller/view mechanism, and use Ning for your data model, user authentication, and user access levels.
  • The application is structured as such:
    app/
        controllers/
        models/
        views/
    lib/
        Zend/
        Zend.php
    xn/
    xn_private/
    index.php
    xn_default.css
    xn_header.view
    

Reference and Resources