CodeIgniter Forums
APPPATH changed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: APPPATH changed (/showthread.php?tid=61445)



APPPATH changed - khashabawy - 04-16-2015

Hello there ,

I used to use the APPPATH variable to point to my application folder 


PHP Code:
<?php echo base_url(APPPATH."views/".style."/assets/css/main.css"); ?>

outputting :

Code:
http://localhost/project/application/views/default/assets/css/main.css


as it was outputting just the name of the application folder not the full path

Now in CI 3 APPPATH is getting the full path of the Application folder 

i have to define a new constant for showing the APPFOLDER

PHP Code:
    $hook['pre_system'] = function(){

        if(!@defined("APPFOLDER")){ 
            @define("APPFOLDER"ltrim(str_replace('\\''/'str_replace(trim(FCPATH,"/"),"",APPPATH) ) , "/" ) ); 
        }                           
    
}; 


I recommend you make it available and predefined 

and add this change to the : 2.x to 3.x guide

thanks for your efforts