Questions tagged [php-include]

The `include()` function in PHP includes code from other PHP files and copies them into the file that uses the include statement.

The include() function in PHP includes code from other PHP files and copies them into the file that uses the include statement.

It is identical to the require() function, except that whilst the include function will emit a warning (E_WARNING) when no file is found, the require function will throw a fatal error (E_COMPILE_ERROR), which will cause the script to abort.

Each time a file is included through the include function, the file will be read and executed. To include a PHP script just once, you can use the include_once() function.

252 questions
2
votes
2 answers

How do I include a .php or .html file in a .html file?

Say I have my file index.html, and I want to include a.php and b.html in them. How exactly will I go by doing this? Here's what I got in index.html: SQL DB Demo
john
  • 139
  • 1
  • 8
2
votes
2 answers

PHP included variables not accessible in main file

I have a main.php file that I'm running certain functions through. When I include another file that just has a bunch of vars defined in it I'm unable to access those vars inside my main.php file. Example of main.php: class MyMain { public…
Exziled
  • 473
  • 5
  • 20
2
votes
1 answer

PHP include function followed by echo

In this stackoverflow discussion a user told me that i could access externally to a php containing the portion of code that at the moment i have on the same .php file. This is my file1.php:
Andrea
  • 152
  • 1
  • 9
2
votes
1 answer

php - how to properly include config?

In A.php I include config.php and B.php: include_once("path/to/config.php"); include_once("path/to/B.php"); B.php is generic script used by other scripts. I don't know if script, which included B.php, also included config.php so in B.php there…
jirinovo
  • 2,105
  • 3
  • 26
  • 37
2
votes
1 answer

php: Execute php file from another php file with parameters

Details: I have a php file that runs some sql and retrieve a list of information. I run through a loop of that information and want to call another php page and pass it some parameters from the data I am looping through. Question: How do I…
MSU_Bulldog
  • 3,501
  • 5
  • 37
  • 73
2
votes
1 answer

Is there a faster way to include PHP files?

I have the following code when I want to include some code from another PHP file: $domain = 'www.example.com'; require_once $domain.'/footer.php'); I wonder though if this is slower than it could be, because surely this then has to go through a DNS…
Amy Neville
  • 10,067
  • 13
  • 58
  • 94
2
votes
4 answers

Display same content (header, nav bar, side bar, footer) on all pages without server-side scripting (PHP)

I would like to keep my header, nav bar, side bar, and footer in sync among all the pages, only with the content/container differentiating. I know there is a PHP command for this (include: http://www.w3schools.com/php/php_includes.asp), but my web…
Paraney
  • 121
  • 1
  • 3
2
votes
2 answers

Is there a way I can separately include section in Laravel blade?

When extending a view in laravel blade, to have multiple places of inserting, it can be done as something like this: This is app/view/layout/default.blade.php {{ HTML::script('js/jquery-2.1.3.min.js') }} {{…
cytsunny
  • 4,838
  • 15
  • 62
  • 129
2
votes
1 answer

Is it required to include any files from gomoob:php-pushwooshto to run a PHP program to send push notifications to iPhone?

I want to send push notifications to iPhone devices by writing PHP code for it. gomoob:php-pushwoosh is a PHP Library that easily work with the pushwoosh REST Web Services. This is the URL for gomoob:php-pushwoosh As per the instructions I've…
PHPLover
  • 1
  • 51
  • 158
  • 311
2
votes
1 answer

Include not working (noobie)

So my include PHP tag is not working for some reason. (I do have wamp server installed, so i can open .php files in browser) index.php:
Ricma357
  • 41
  • 5
2
votes
1 answer

View PHP file with includes included

Is there a tool that will show me what my .php file looks like AFTER the "preprocessor" goes through it and includes all the "include" and "require" files? In other words, if I have a file called "index.php":
MillerTed
  • 21
  • 2
2
votes
1 answer

include of this file does not work

When I try to include this file in any of my other pages it doesn't work. Any ideas why? file structure: index.php (FOLDER - core) init.php (FOLDER - functions) sanitise.php (FOLDER - browse) blog.php , ecommerce.php... …
Tauciokas
  • 101
  • 1
  • 1
  • 13
2
votes
1 answer

External stylesheets vs style tags with a php include

One of the things many web designers learn is that the more things you have that are external to a page, the longer it takes to fully load the page, because more server requests are made. The most common way people style their pages is by using…
Hiigaran
  • 829
  • 10
  • 28
2
votes
3 answers

WordPress blog_content character limit

Great people of Stack, I once again require your assistance. I currently have an external website that pulls through blog content from a sub-folder containing a WordPress installation, for example: Website A: External Static Website Website B:…
Aaron Lee
  • 1,146
  • 3
  • 14
  • 29
2
votes
1 answer

including multiple files in different directories php

I am have trouble including files containing functions. I have a file called blog.php that runs the following:
rodzilla
  • 335
  • 2
  • 4
  • 13
1 2
3
16 17