I use .inc files for my headers and footers. I do not know why I use it though. The first site I ever built was build by looking at the code from a site my old business partner built. SO I took a look at this code and started piecing things together. He had .inc headers so I have been using them for about 1 year now but I am not sure what the benefits are (if any). I guess from a design stand point it makes everything cleaner but besides that what are the advantages and disadvantages?
that's what I do? I am asking what are the benefits of using .inc files as opposed to just throwing all the header info into the main file.
Think of .inc files as common files of common codes. Let's say you have multiple web pages. Rather than coding each file/page with common codes you link them to a file. That way you can update one file and it will change all pages that have the .inc in them. Common practice is to use .inc for Headers, Footers, Meta, Head, navigation and any other common codes you can think of that will be redundant in all pages. It's very efficient way of coding.
.inc doesn't really do anything. You can save your files as .html,.php,/inc.html, or .blueparukiaisawesome. Shall make no difference.
But you can do that with any file extensions. You can use include('file.extension"), and i will work. I'd normally save them as .html or .php so anyone can access them.
inc means includes. it doesnt matter what you name them to, but its better to have a well organized structure to know what file serves what. use .inc as file extension, you can also use .txt as file extension, but you wouldnt know wheter they are includes or not. better use a name that relates to that purpose
I use same since nearly 2 yrs disadvantages are none in my experience advantages are manifold 1. you can modify header section with some seasonal promotion without having to change pages 2. you can add banner to your site or other sites 3. you can insert your adsense code - thus having a very few files to control your adsense formats and appearances for the entire site ( that is definitely a HUGE advantage ) 4. for footer - you can modify site-wide links to new sections or major pages overall it makes the site dynamic while using flat files that are far easier to maintain. it allows you to change in a single file some text that appears on a wide range of pages across the site but to fully benefit from include files - use a system by subfolders or topics that allows you to individually adapt the different major topics of your site. I have typically 3 include files top ( above the fold = ATF ) for adsense, for "advertise on this site, and for the social bookmarking widget and seasonal additional banners for my OWN site's promotion. top-LEFT - for a vertical adsense 160x600 and my own vertical banners or addtional info footer - for links and G search box I would NEVER want to miss this feature again - it has brought me TEN thousands of additional adsense $ / year since I implemented the fully tested and refined include system in my flat files some 1,5 yrs ago
Correct me if I'm wrong, but the main purpose of the .inc extension as opposed to a .php or .html extension is so a browser won't render the file when loaded. I could be way off base here, but I thought I read that somewhere...
For most html includes, it wouldn't matter if someone saw them or not. Unless otherwise directed, the server will send .inc files as text/plain. The problem arises when your php logic includes a file containing things like user names and passwords, or sql queries; all of which are security issues. For those files, you should put them in a directory outside the document root tree. It is also a good idea to add this directive to the httpd.conf file or your .htaccess file. <Files ~ "\.inc$"> Order allow,deny Deny from all </Files> Code (markup): Anyone trying to GET an .inc file will see a 404 error. cheers, gary