cgm225 Posted May 20, 2008 Share Posted May 20, 2008 I have seen include files with the following extensions: somefile.php somefile.inc.php somefile.inc What is the most appropriate file extension for include? Quote Link to comment https://forums.phpfreaks.com/topic/106459-include-files-what-extension-to-use/ Share on other sites More sharing options...
MadTechie Posted May 20, 2008 Share Posted May 20, 2008 if it contains php code then use either somefile.php somefile.inc.php NOT somefile.inc if its does not contain php code then any Quote Link to comment https://forums.phpfreaks.com/topic/106459-include-files-what-extension-to-use/#findComment-545656 Share on other sites More sharing options...
jonsjava Posted May 20, 2008 Share Posted May 20, 2008 I agree with MadTechie. I usually use somefile.inc.php format (so when I revisit the code later, I can tell what it was doing) or, I put all my includes in an include folder. Quote Link to comment https://forums.phpfreaks.com/topic/106459-include-files-what-extension-to-use/#findComment-545658 Share on other sites More sharing options...
GingerRobot Posted May 20, 2008 Share Posted May 20, 2008 Never use .inc -- ever. Unless you have your sever set up correctly, the source code would be displayed if someone navigated directly to these pages. And even then, you leave yourself open to problems in the future should the server set up change. It's more personal preference with regard to .inc.php or .php -- i personally would use .php, though store the files in a separate includes folder. Seems less messy, but that's just opinion. Quote Link to comment https://forums.phpfreaks.com/topic/106459-include-files-what-extension-to-use/#findComment-545661 Share on other sites More sharing options...
jonsjava Posted May 20, 2008 Share Posted May 20, 2008 decided to put this together. This is the typical layout of my applications (generic layout, mind you): <root folder> <images> <includes> <admin> <templates> <template_folder> <installer> <sql/scripts> Quote Link to comment https://forums.phpfreaks.com/topic/106459-include-files-what-extension-to-use/#findComment-545679 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.