Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Hoef said:
Where do you see them? ... Mostly they are include files.

Actually, I am working on a website for a prominent architecture school, and the previous designer used php I noticed. And the files that the php pages point to for content are INC files. They contain regular html code, so I was wondering why he would have used them. BBEDIT recognizes them, but dreamweaver does not.

What are inc files, and why would one want to use them? :confused:
 
I use .inc extensions on included files to differentiate them between a full PHP or HTML page. It's like naming a plain text document .txt instead of .rtf or .doc - it's more semantically correct.
 
.inc(lude) files are pretty handy. they're the best when used for headers and/or footers so if you have x*1000 pages you can change that one file and all x*1000 pages get that change.

also, .inc files are good if you have a goodly amount of reused functions (like you probably should) throughout all of your, in your case, php scripts. this way you don't have to copy-paste the same code on each page and if you find a *bgu* you can change it just once and not have to worry about the other x*1000 pages.

with the proper statements in your html/php/whatever_other_stuff_you_use pages, you can include these files just like they are copied/pasted. it literally does the copy/paste for you! the .inc extension is just for convenience; you could use .idc (i don't care) if you wanted as long as it is a text file.
 
just take note when you are using server-side include (php/jsp/..) in your .inc, you have to remember to check whether the server parse the .inc file as script file. If not, it can be a security loophole if people unknowingly stumble upon them when they are place in those web accessible folders.
 
angelneo said:
just take note when you are using server-side include (php/jsp/..) in your .inc, you have to remember to check whether the server parse the .inc file as script file. If not, it can be a security loophole if people unknowingly stumble upon them when they are place in those web accessible folders.

Alternatively, you could store .inc files outside of a servable directory (or a protected one). This will ensure that nobody will stumble upon them.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.