Location: PHPKode > projects > ASf MVC > asf-mvc/asmvc/sysfiles/plugins/internal.ASfMVC_Model.php
<?php
/***
 * Name:	AlexSnet's framework MVC
 * About:	An MVC application framework for PHP
 * Copyright:	(C) 2008, Sudo me.
 * Author:	Alex Snet, me [at] alexsnet [dot] ru
 * Site:	http://alexsnet.ru/
 ***/

// ------------------------------------------------------------------------

/**
 * ASfMVC_Model
 *
 * @package		ASfMVC
 * @author		Alex Snet
 */

class ASfMVC_Model
{


 	/**
	 * $db
	 *
	 * the database object instance
	 *
	 * @access	public
	 */
  var $db = null;  
    
 	/**
	 * class constructor
	 *
	 * @access	public
	 */
  function __construct() {

    /* load config information */
    include(ASMVC_MYAPPDIR . 'configs' . DS . 'database.php');  

    if(!empty($config['plugin']))
    {
      $filename = 'db.' . $config['plugin'] . '.php';
      
      /* look for the plugin in apps/myfiles/sysfiles plugins dirs */
      $filepath = ASMVC_MYAPPDIR . 'plugins' . DS . $filename;
      if(!file_exists($filepath))
        $filepath = ASMVC_BASEDIR . 'myfiles' . DS . 'plugins' . DS . $filename;
      if(!file_exists($filepath))
        $filepath = ASMVC_BASEDIR . 'sysfiles' . DS . 'plugins' . DS . $filename;
      
      if(!file_exists($filepath))
        trigger_error("Unknown database library '{$config['plugin']}'",E_USER_ERROR);
      
      require_once($filepath);

      /* classname must match the plugin name */      
      if(!class_exists($config['plugin']))
        trigger_error("Unknown database class '{$config['plugin']}'",E_USER_ERROR);
      
      /* assign the object instance as a property */
      $this->db = new $config['plugin'];
    }

  }
  
}

?>
Return current item: ASf MVC