How do I insert a .php into my html page?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sexy Gal
Forum Newbie
Posts: 4
Joined: Thu Feb 05, 2004 3:06 am

How do I insert a .php into my html page?

Post by Sexy Gal »

How do I insert a .php into my html page?

Do you need to put it into a table. I'm not sure what to so.

I'm using Frontpage 98.
andylyon87
Forum Contributor
Posts: 168
Joined: Sat Jan 31, 2004 5:31 am
Location: Dundee

Post by andylyon87 »

You could use:

Code: Select all

<?php
require(filename.php);
?>
This should be inserted where you want the page to appear. You would need to replace the filename with the appropriate name.
Sexy Gal
Forum Newbie
Posts: 4
Joined: Thu Feb 05, 2004 3:06 am

Post by Sexy Gal »

Didnt work :(
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You also need to have PHP set up on a webserver and need to use the correct extension for the file - normally for PHP it is .php.

Mac
andylyon87
Forum Contributor
Posts: 168
Joined: Sat Jan 31, 2004 5:31 am
Location: Dundee

Post by andylyon87 »

Sorry I took for granted that you had a php server. You can go to http://www.easyphp.org/telechargements.php3, download v1.7 (10mb) and this way you can run a virtual server on your computer and it won't cost you a thing. I use it all the time it works perfect. It's a french program but there are updates which convert the instructions to English or whatever. If you need the english conversion you can go to the same site and download the local pages.
Sexy Gal
Forum Newbie
Posts: 4
Joined: Thu Feb 05, 2004 3:06 am

Post by Sexy Gal »

I do have a php server..

Here's my link..
http://www.sch-county.com/testbeta/Auto ... oIndex.php?

What I want to do is put this autoindex.php in the middle of a web page.

Can ya help a lady out? :)
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Just make the page, then where you want to insert the php page do:

<?php
include("autoindex.php");
?>

And it will be included. You then must save this page with an extension that the server knows it should parse for php - generally .php or .php3 - and then your done.

So your page is likely to be called something like: index.php and that will include the autoindex.php page in it.
Sexy Gal
Forum Newbie
Posts: 4
Joined: Thu Feb 05, 2004 3:06 am

Post by Sexy Gal »

Hmmm, tried that also.. Doesnt seem to work for me. I have to be doing something wrong.

Can you give me an example?
andylyon87
Forum Contributor
Posts: 168
Joined: Sat Jan 31, 2004 5:31 am
Location: Dundee

Post by andylyon87 »

do you want the page in amongst other php elements
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Maby its better if you give a piece of the code you have now.. to see what youre doing wrong.


Like kettle_drum said. youre extensions do have to be php/ php3 of them pages you are including something.

Code: Select all

<?php
include("somepage.php");

// or

include ("footer.php");
include ("header.php");

// should do it.
?>
Post Reply