Show
Ignore:
Timestamp:
05/25/06 02:58:10 (6 years ago)
Author:
john
Message:

Major changes to environment added boot.php and Trax class to hold framwork config

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_controller.php

    r200 r201  
    282282 
    283283    /** 
    284      *  File extension appended to view files 
    285      * 
    286      *  Set from a define in {@link environment.php}.  Usually phtml 
    287      *  @var string 
    288      */ 
    289     public $views_file_extention = TRAX_VIEWS_EXTENTION; 
    290  
    291     /** 
    292284     *  Render controllers layout 
    293285     * 
     
    375367 
    376368        // Load the routes. 
    377         require(TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['config']."/routes.php"); 
     369        require(Trax::$config_path."/routes.php"); 
    378370        $this->router = $router; 
    379371        if(is_object($this->router)) { 
     
    410402     *  @uses set_paths() 
    411403     *  @uses $url_path 
    412      *  @uses $views_file_extention 
    413404     *  @uses $views_path 
    414405     *  @return boolean 
     
    432423        //error_log('browser url='.$browser_url); 
    433424        # strip off url prefix, if any 
    434         if(!is_null(TRAX_URL_PREFIX)) { 
    435             $browser_url = str_replace(TRAX_URL_PREFIX,"",$browser_url); 
     425        if(!is_null(Trax::$url_prefix)) { 
     426            $browser_url = str_replace(Trax::$url_prefix, "", $browser_url); 
    436427        } 
    437428 
     
    453444 
    454445        if($this->router->routes_count > 0) { 
    455             $this->controllers_path = TRAX_ROOT . $GLOBALS['TRAX_INCLUDES']['controllers']; 
    456             $this->helpers_path = $this->helpers_base_path = TRAX_ROOT . $GLOBALS['TRAX_INCLUDES']['helpers']; 
     446            $this->controllers_path = Trax::$controllers_path; 
     447            $this->helpers_path = $this->helpers_base_path = Trax::$helpers_path; 
    457448            $this->application_controller_file = $this->controllers_path . "/application.php"; 
    458449            $this->application_helper_file = $this->helpers_path . "/application_helper.php"; 
    459             $this->layouts_path = TRAX_ROOT . $GLOBALS['TRAX_INCLUDES']['layouts']; 
    460             $this->views_path = TRAX_ROOT . $GLOBALS['TRAX_INCLUDES']['views']; 
     450            $this->layouts_path = Trax::$layouts_path; 
     451            $this->views_path = Trax::$views_path; 
    461452 
    462453            $route = $this->router->find_route($browser_url); 
     
    560551     *  @uses Session::unset_var() 
    561552     *  @uses $view_file 
    562      *  @uses $views_file_extention 
    563553     *  @uses $views_path 
    564554     *  @return boolean true 
     
    598588                    $this->controller_object->views_path = $this->views_path; 
    599589                    $this->controller_object->layouts_path = $this->layouts_path; 
    600                     $GLOBALS['current_controller_path'] = "$this->added_path/$this->controller"; 
    601                     $GLOBALS['current_controller_name'] = $this->controller; 
    602                     $GLOBALS['current_action_name'] = $this->action; 
    603                     $GLOBALS['current_controller_object'] =& $this->controller_object; 
     590                    Trax::$current_controller_path = "$this->added_path/$this->controller"; 
     591                    Trax::$current_controller_name = $this->controller; 
     592                    Trax::$current_action_name = $this->action; 
     593                    Trax::$current_controller_object =& $this->controller_object; 
    604594                    # Which layout should we use? 
    605595                    $layout_file = $this->controller_object->determine_layout(); 
     
    611601                            include_once(TRAX_LIB_ROOT."/scaffold_controller.php"); 
    612602                            $this->controller_object = new ScaffoldController($scaffold); 
    613                             $GLOBALS['current_controller_object'] =& $this->controller_object; 
     603                            Trax::$current_controller_object =& $this->controller_object; 
    614604                            $render_options['scaffold'] = true; 
    615605                            if(!file_exists($layout_file)) { 
     
    667657                        //          .var_export($this->action_params,true)); 
    668658                        $this->controller_object->$action($this->action_params); 
    669                     } elseif(file_exists($this->views_path . "/" . $this->action . "." . $this->views_file_extention)) { 
     659                    } elseif(file_exists($this->views_path . "/" . $this->action . "." . Trax::$views_extension)) { 
    670660                        //error_log('views file "'.$this->action.'"'); 
    671661                        $action = $this->action; 
     
    722712                        if(!$this->controller_object->render_file($layout_file, false, $locals)) { 
    723713                            # No layout template so just echo out whatever is in $content_for_layout 
    724                             echo "HERE"; 
     714                            //echo "HERE"; 
    725715                            echo $content_for_layout;         
    726716                        } 
     
    991981            $this->view_file = TRAX_LIB_ROOT."/templates/scaffolds/".$action.".phtml";     
    992982        } else {     
    993             $this->view_file = $this->views_path . "/" . $action . "." . $this->views_file_extention; 
     983            $this->view_file = $this->views_path . "/" . $action . "." . Trax::$views_extension; 
    994984        } 
    995985        //error_log(get_class($this)." - render_action() view_file: $this->view_file"); 
     
    10301020        # Renders a template relative to app/views 
    10311021        if($use_full_path) { 
    1032             $path = $this->views_path."/".$path.".".$this->views_file_extention; 
     1022            $path = $this->views_path."/".$path.".".Trax::$views_extension; 
    10331023        }  
    10341024 
     
    10971087            $file = substr(strrchr($path, "/"), 1); 
    10981088            $path = substr($path, 0, strripos($path, "/")); 
    1099             $file_with_path = TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['views']."/".$path."/_".$file.".".$this->views_file_extention; 
     1089            $file_with_path = Trax::$views_path."/".$path."/_".$file.".".Trax::$views_extension; 
    11001090        } else { 
    11011091            $file = $path; 
    1102             $file_with_path = $this->views_path."/_".$file.".".$this->views_file_extention; 
     1092            $file_with_path = $this->views_path."/_".$file.".".Trax::$views_extension; 
    11031093        } 
    11041094         
     
    11101100                    $spacer_file = substr(strrchr($spacer_path, "/"), 1); 
    11111101                    $spacer_path = substr($spacer_path, 0, strripos($spacer_path, "/")); 
    1112                     $spacer_file_with_file = TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['views']."/".$spacer_path."/_".$spacer_file.".".$this->views_file_extention; 
     1102                    $spacer_file_with_file = TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['views']."/".$spacer_path."/_".$spacer_file.".".Trax::$views_extension; 
    11131103                } else { 
    11141104                    $spacer_file = $spacer_path; 
    1115                     $spacer_file_with_file = $this->views_path."/_".$spacer_file.".".$this->views_file_extention; 
     1105                    $spacer_file_with_file = $this->views_path."/_".$spacer_file.".".Trax::$views_extension; 
    11161106                }   
    11171107                if(file_exists($spacer_file_with_file)) { 
     
    11701160 
    11711161        # Default settings 
    1172         $layouts_base_path = TRAX_ROOT . $GLOBALS['TRAX_INCLUDES']['layouts']; 
    1173         $default_layout_file = $layouts_base_path . "/application." . $this->views_file_extention; 
     1162        $layouts_base_path = Trax::$layouts_path; 
     1163        $default_layout_file = $layouts_base_path . "/application." . Trax::$views_extension; 
    11741164         
    11751165        if(!$full_path && $layout) { 
     
    11801170                $file = substr(strrchr($layout, "/"), 1); 
    11811171                $path = substr($layout, 0, strripos($layout, "/")); 
    1182                 $layout = $layouts_base_path."/".$path."/".$file.".".$this->views_file_extention; 
     1172                $layout = $layouts_base_path."/".$path."/".$file.".".Trax::$views_extension; 
    11831173            } else { 
    11841174                # Is there a layout for the current controller 
    1185                 $layout = $this->layouts_path."/".$layout.".".$this->views_file_extention; 
     1175                $layout = $this->layouts_path."/".$layout.".".Trax::$views_extension; 
    11861176            } 
    11871177 
     
    12611251        header('status: {$error_code} {$error_heading}');  
    12621252        # check for user's layout for errors 
    1263         if(DEBUG && file_exists(TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['layouts']."/trax_error.".TRAX_VIEWS_EXTENTION)) { 
    1264             include(TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['layouts']."/trax_error.".TRAX_VIEWS_EXTENTION); 
    1265         } elseif(DEBUG && file_exists(TRAX_LIB_ROOT."/templates/error.phtml")) { 
     1253        if(TRAX_ENV == "development" && file_exists(Trax::$layouts_path."/trax_error.".Trax::$views_extension)) { 
     1254            include(Trax::$layouts_path."/trax_error.".Trax::$views_extension); 
     1255        } elseif(TRAX_ENV == "development" && file_exists(TRAX_LIB_ROOT."/templates/error.phtml")) { 
    12661256            # use default layout for errors 
    12671257            include(TRAX_LIB_ROOT."/templates/error.phtml"); 
    1268         } elseif(DEBUG) { 
     1258        } elseif(TRAX_ENV == "development") { 
    12691259            echo "<font face=\"verdana, arial, helvetica, sans-serif\">\n"; 
    12701260            echo "<h1>$error_heading</h1>\n";