Can you please tell me why we include database configuration in a file where extension "inc" is used and why we make templates using TPL extension ??
well, for starters they are not required on php, .tpl files are used by smarty, and a config file with a .inc extension is a security threat if your server is not configured to process them as php files because, they will be outputted as plain text when accessed through a browser
Well. It doesn't really matter what type of fileextension you use, as long as the parser, and the server you're running it on, understands what to do with the files. Any file can contain any type of code, it's the parsing of the file that makes it do whatever it's meant to do. For instance, putting the database config in a .inc file doesn't really make all that much sense - however, if you do, make sure you have a .htaccess file in the root folder containing the following: <FilesMatch "\.(inc)$"> order allow,deny deny from all </FilesMatch> Code (markup): which will disallow access to any files with the .inc file-extension from external nodes. It will still be fully processable by PHP. You can also add different types of file-extensions to the above rule, if you want. So, for instance you could have: <FilesMatch "\.(inc|txt|csv|old)$"> order allow,deny deny from all </FilesMatch> Code (markup): to prevent access to all .inc, .csv, .txt and .old files on the server.
.tpl extensions are used where Smarty Template Engine is used. Have a look http://www.smarty.net/ if a coder uses this for a script it makes it easy for the user to edit as its user friendly . Template part is differentiated from coding part