Jump to content

php include


Jonas

Recommended Posts

Ok, so I was wondering:If you use "php include" function, is that sort of like using iframe? And if so, how do you decide the size of the included file, so that it isn't displayed in the same resolution covering the other content? Do you put it inside a <div>, and then give the div width and height sizes?

Link to comment
Share on other sites

the php include function allows you to insert content from another file. it's not an iframe, although it is very similar. where an iframe adds a box with another page in, the php include function simply uses the coding inside the file and puts it into the file with the include function in. so when you preview the file, instead of seeing a page with a box with another pae inside it, you see the page, and the included file outputs into the same page. notes: for easy reference save include files as filename.inc.INCLUDE.INC FILE:

<img src="header.gif" width="100" border="0" />

MAIN FILE:

<php include("include.inc"); ?><p align="justify">Welcome to my site... do you like my logo above?</p>

WOULD APPEAR AS:

<img src="header.gif" width="100" border="0" /><p align="justify">Welcome to my site... do you like my logo above?</p>

hope this clarifies things a bit.Matt

Link to comment
Share on other sites

the php include function allows you to insert content from another file. it's not an iframe, although it is very similar. where an iframe adds a box with another page in, the php include function simply uses the coding inside the file and puts it into the file with the include function in. so when you preview the file, instead of seeing a page with a box with another pae inside it, you see the page, and the included file outputs into the same page. notes: for easy reference save include files as filename.inc.INCLUDE.INC FILE:
<img src="header.gif" width="100" border="0" />

MAIN FILE:

<php include("include.inc"); ?><p align="justify">Welcome to my site... do you like my logo above?</p>

WOULD APPEAR AS:

<img src="header.gif" width="100" border="0" /><p align="justify">Welcome to my site... do you like my logo above?</p>

hope this clarifies things a bit.Matt

Ah, it does... :)So if I wanted to make an external menu, I would make an inc file with code for just the menu, not the
<html><head>...</head><body>...

etc.? Just for example

<div>Menu: <a>1</a><a>2</a></div>

?

Link to comment
Share on other sites

yep exactly... it simply copies the contents from the include file to your main file, so if you put <html><head>.. </head></html> in your include file... it will mean your main file has two html and 2 head tags :) simple(glad i explained that so well in first post lol)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...