Zend Framework-where should this root.php file go for MVC?

Posted by Joel on Stack Overflow See other posts from Stack Overflow or by Joel
Published on 2010-06-14T04:49:10Z Indexed on 2010/06/14 4:52 UTC
Read the original article Hit count: 224

Filed under:
|
|

Hi guys, I'm converting over a web-app to use the MVC structure of Zend Framework. I have a root.php include file that contains most of the database info, and some static variables that are used in the program. I'm not sure if some of this should be in the application.ini of in a model that is called by the init() function in a controller, or in the bootstrap or what?

Any help would be much appreciated!

root.php (include file at the top of every php page):

<?php

    /***
            //Configuration file
    */

    ## Site Configuration starts ##


    define("SITE_ROOT"      ,  dirname(__FILE__));


    define("SITE_URL"      ,  "http://localhost/monkeycalendarapp/monkeycalendarapp/public");
    define('DB_HOST', "localhost");
    define('DB_USER', "root");
    define('DB_PASS', "xxx");
    define('DB_NAME', "xxxxx");

    define("PROJECT_NAME"      ,  "Monkey Mind Manager (beta 2.2)"); //site title
    define("CALENDAR_WIDTH"      ,  "300"); //left mini calendar width
    define("CALENDAR_HEIGHT"    ,  "150"); //left mini calendar height

    $page_title = 'Event List';
  $stylesheet_name = 'style.css'; //default stylesheet


  define("SITE_URL_AJAX"    ,  SITE_URL . "/ajax-tooltip");
  define("JQUERY"    ,  SITE_URL . "/jquery-ui-1.7.2");

  $a_times    =  array("12:00","12:30","01:00","01:30","02:00","02:30","03:00","03:30","04:00","04:30","05:00","05:30","06:00","06:30","07:00","07:30","08:00","08:30","09:00","09:30","10:00","10:30","11:00","11:30");

  //PTLType Promotional timeline type
  $a_ptlType= array(1=>"Gigs","To-Do","Completed");

  $a_days      =  array("Su","Mo","Tu","We","Th","Fr","Sa");

  $a_timesMerd  =  array("12:00am","12:30am","01:00am","01:30am","02:00am","02:30am","03:00am","03:30am","04:00am","04:30am","05:00am","05:30am","06:00am","06:30am","07:00am","07:30am","08:00am","08:30am","09:00am","09:30am","10:00am","10:30am","11:00am","11:30am","12:00pm","12:30pm","01:00pm","01:30pm","02:00pm","02:30pm","03:00pm","03:30pm","04:00pm","04:30pm","05:00pm","05:30pm","06:00pm","06:30pm","07:00pm","07:30pm","08:00pm","08:30pm","09:00pm","09:30pm","10:00pm","10:30pm","11:00pm","11:30pm");

  //Setting stylesheet for this user.
  $AMPM=array("am"=>"am","pm"=>"pm");

  include(SITE_ROOT  .  "/includes/functions/general.php");
  include(SITE_ROOT  .  "/includes/db.php");

  session_start();
  if(isset($_SESSION['userData']['UserID']))  {
    $s_userID   =   $_SESSION['userData']['UserID'];
  }

  $stylesheet_name = stylesheet();

  ini_set('date.timezone', 'GMT');
  date_default_timezone_set('GMT');

  if($s_userID) {
    ini_set('date.timezone', $_SESSION['userData']['timezone']);
    date_default_timezone_set($_SESSION['userData']['timezone']);
  }

?>

© Stack Overflow or respective owner

Related posts about php

Related posts about mvc