Site Class

Framework allows multiple sites to be ran independently of each other from a single installation. Each site you wish to run must have it's own SiteClass, which will extend from Framework_Site_Common. The function Framework::start() requires the SiteClass name to be passed as its only argument. If you are running Framework 0.1.4 or later you can find an example site in /path/to/pear/doc/Framework.

Creating a Site Class

  1. Change into your FRAMEWORK_BASE_PATH/Framework/Site directory.
  2. mkdir -p MySite/Templates/Default/templates
    1. mkdir MySite/Templates/Default/templates_c
    2. mkdir MySite/Templates/Default/cache
    3. mkdir MySite/Templates/Default/config
  3. touch MySite.php
  4. Create and edit MySite/config.xml (See ConfigXml)
  5. Edit MySite.php and create Framework_Site_MySite (See example below)
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Framework_Site_MySite
 * 
 * @author      Joe Stump <joe@joestump.net>
 * @copyright   Joe Stump <joe@joestump.net>
 * @package     Framework
 * @filesource
 */


/**
 * Framework_Site_MySite
 * 
 * Framework allows you to run multiple sites with multiple templates and
 * modules. Each site needs it's own site driver. You can use this to house
 * centrally located/needed information and such. 
 * 
 * @author      Joe Stump <joe@joestump.net>
 * @copyright   Joe Stump <joe@joestump.net>
 * @package     Framework
 * @filesource
 */
class Framework_Site_MySite extends Framework_Site_Common
{
    /**
     * $name
     *
     * @access      public
     * @var         string      $name       Name of site driver
     */
    public $name = 'MySite';

    /**
     * prepare
     *
     * This function is ran by Framework right after loading up the site
     * driver. It's a good place to put initialization type code that is
     * globally required throughout your site.
     *
     * @access      public
     * @return      mixed
     */
    public function prepare()
    {

    }
}

?>