Questions tagged [include]

A provision that many programming languages provide to allow functionality defined in one file to be used in another.

include is a provision that many programming languages provide to allow functionality (code such as functions, classes, objects etc.) in one file or package to be referenced and used in another.

Example (PHP)

include './dir/file.php';

Resources

9740 questions
6246
votes
71 answers

How do I include a JavaScript file in another JavaScript file?

How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS?
Alec Smart
  • 94,115
  • 39
  • 120
  • 184
3045
votes
30 answers

What is the difference between #include and #include "filename"?

What is the difference between using angle brackets and quotes in an include directive? #include #include "filename"
quest49
  • 49,608
  • 5
  • 21
  • 14
1424
votes
28 answers

Difference between require, include, require_once and include_once?

In PHP: When should I use require vs. include? When should I use require_once vs. include_once?
Scott B
  • 38,833
  • 65
  • 160
  • 266
796
votes
44 answers

Include another HTML file in a HTML file

I have 2 HTML files, suppose a.html and b.html. In a.html I want to include b.html. In JSF I can do it like that: It means that inside a.xhtml file, I can include b.xhtml. How can we do it in *.html file?
lolo
  • 17,392
  • 9
  • 25
  • 49
681
votes
6 answers

Inserting a PDF file in LaTeX

I am trying to insert a PDF or doc file as an appendix in my LaTeX file. Do you know how I can do this?
Guido
  • 6,853
  • 3
  • 16
  • 9
519
votes
11 answers

What is the difference between include and require in Ruby?

My question is similar to "What is the difference between include and extend in Ruby?". What's the difference between require and include in Ruby? If I just want to use the methods from a module in my class, should I require it or include it?
Owen
  • 22,247
  • 13
  • 42
  • 47
480
votes
7 answers

What is the difference between include and extend in Ruby?

Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me. include: mixes in specified module methods as instance methods in the target class extend: mixes in specified module methods as class methods in the…
Gishu
  • 134,492
  • 47
  • 225
  • 308
406
votes
10 answers

What is the difference between #import and #include in Objective-C?

What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated? I was reading the following tutorial: http://www.otierney.net/objective-c.html#preamble and its…
Ryan Guill
  • 13,558
  • 4
  • 37
  • 48
405
votes
8 answers

What is the correct syntax of ng-include?

I’m trying to include an HTML snippet inside of an ng-repeat, but I can’t get the include to work. It seems the current syntax of ng-include is different than what it was previously: I see many examples using
Jakob Jingleheimer
  • 30,952
  • 27
  • 76
  • 126
398
votes
6 answers

What is the purpose of Android's tag in XML layouts?

I've read Romain Guy's post on the tag, but I still don't understand how it's useful. Is it a sort-of replacement of the tag, or is it used like so: . . …
cesar
  • 8,944
  • 12
  • 46
  • 59
366
votes
11 answers

C/C++ include header file order

What order should include files be specified, i.e. what are the reasons for including one header before another? For example, do the system files, STL, and Boost go before or after the local include files?
Anycorn
  • 50,217
  • 42
  • 167
  • 261
355
votes
19 answers

Detecting superfluous #includes in C/C++

I often find that the headers section of a file gets larger and larger all the time, but it never gets smaller. Throughout the life of a source file, classes may have moved and been refactored and it's very possible that there are quite a few…
shoosh
  • 76,898
  • 55
  • 205
  • 325
349
votes
4 answers

How can I add a default include path for GCC in Linux?

I'd like GCC to include files from $HOME/include in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the…
Jesse Beder
  • 33,081
  • 21
  • 109
  • 146
280
votes
11 answers

How to include JavaScript file or library in Chrome console?

Is there a simpler (native perhaps?) way to include an external script file in the Google Chrome browser? Currently I’m doing it like this: document.head.innerHTML += '';
technocake
  • 2,909
  • 2
  • 15
  • 4
266
votes
14 answers

Get absolute path of initially run script

I have searched high and low and get a lot of different solutions and variables containing info to get the absolute path. But they seem to work under some conditions and not under others. Is there one silver bullet way to get the absolute path of…
inquam
  • 12,664
  • 15
  • 61
  • 101
1
2 3
99 100