PHP Include File<

admin

Administrator
Staff member
In asp I was able to <!--#INCLUDE FILE=

How can this be done in php? I want to call an html page to be placed within another page's table.

How can I do this in php?here's a good thread:

<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=32364">http://www.htmlforums.com/showthread.ph ... adid=32364</a><!-- m --><?php
include("page.html");
?>Thank you, very helpful. Another question...

Say I have a host of articles, all html with links in them to other articles. Would it be possible (short of using frames) to use my template, then place the include into the table. Then have subsequent pages display into that template rather then the html page itself.

Confusing? :confused:

Basically like how frames work, if I had a header with navigation, each time I clicked on a link it would open in the child frame and the header will still be there. That is what I need, links in those pages to open into my template.no, unless you use frames. you can only make a link open in the same window or a new one with out frames.That is what I was afraid of. Thanks anyways.you could but you will have to change all the link in your page...
instead of
<a href=http://www.htmlforums.com/archive/index.php/"page1.html">
you could have
<a href=http://www.htmlforums.com/archive/index.php/"index.php?Page=page1">
<a href=http://www.htmlforums.com/archive/index.php/"index.php?Page=page2">

and in index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<table>
<tr><td colspan="2">Top</td></Tr>
<tr>
<td>Left</Td>
<td><?php include $_GET['Page'].'.html'; ?></td>
</tr>
</table>
</body>
</html>

and you will have to keep only what inside the <body> tag
like
page1.html
<h1>This is First Page</h1>

page2.html
<h1>This is Second Page</h2>


they may be an hard way to remove the unwanted part and rewrite the url while including the file in the php script!!one note about what illogique posted, that code may look nice and simple, but it is a very big security risk, some1 may have written a bad bad script and just put the ?Page=<insertbadurlhere> so don't use it for a main page :)

-jacoband he has to reload the page each time, that is not what he asked for. he wanted to do it without reloading, like you do with a frame.
 
Top