 |
11-17-2004, 05:16 AM
|
#1 (permalink)
|
|
Contributing Member
Join Date: 05-17-04
Location: London, United Kingdom
Posts: 1,200
Latest Blog: None
|
php includes-what have I done wrong?
I have saved my page as .php
I have inserted the code
Quote:
|
<?php include("menu.htm") ?>
|
with the intention of the menu (which can be found by clicking here) being displayed in every page of my site where I include the code above so I don't have to constantly update every page of my site when I make a difference to one link or add another, but I uploaded it but it hasn't worked. I have also looked into css files, but ideally I want this to work. Could someone look at my page and code and please advise me?
I would be so greatful.
Jason
The link to the main page is here. http://robotwarsfansite.atspace.com/example/include.php
|
|
|
11-17-2004, 06:04 AM
|
#2 (permalink)
|
|
Contributing Member
Join Date: 05-24-04
Location: Sydney, Australia
Posts: 479
|
Hey mate,
I remember just the other day you were talking about this issue. I don't know too much PHP coding, perhaps your web server doesn't support PHP? I doubt this though.
To do what your trying to achieve, just use SSI includes.
For example: <!--#include virtual="menu.htm" -->
Put this code anywhere on the page where you want to insert the menu. Make sure the file extensions are changed to .shtml to support it.
Last edited by dcristo : 11-17-2004 at 06:07 AM.
|
|
|
11-17-2004, 06:08 AM
|
#3 (permalink)
|
|
Contributing Member
Join Date: 05-17-04
Location: London, United Kingdom
Posts: 1,200
Latest Blog: None
|
I can save in FrontPage .shtml files, it just doesn't come up on screen.
|
|
|
11-17-2004, 06:13 AM
|
#4 (permalink)
|
|
Contributing Member
Join Date: 05-17-04
Location: London, United Kingdom
Posts: 1,200
Latest Blog: None
|
could you give me an example of where yhis is used in case I am inserting the code in the wrong place?
|
|
|
11-17-2004, 06:14 AM
|
#5 (permalink)
|
|
Contributing Member
Join Date: 05-24-04
Location: Sydney, Australia
Posts: 479
|
Thats cause the SSI code is processed server side (not the browser). Upload the shtml files to your webserver and you'll be cheering. Just make sure the menu htm file is in the same directory as the shtml files on your server.
|
|
|
11-17-2004, 06:17 AM
|
#6 (permalink)
|
|
Contributing Member
Join Date: 05-24-04
Location: Sydney, Australia
Posts: 479
|
Quote:
|
Originally Posted by Jason
could you give me an example of where yhis is used in case I am inserting the code in the wrong place?
|
Say for example you had a left column menu. Place the SSI code between the <td> and </td> tags... get me?
|
|
|
11-17-2004, 06:21 AM
|
#7 (permalink)
|
|
Contributing Member
Join Date: 05-17-04
Location: London, United Kingdom
Posts: 1,200
Latest Blog: None
|
unfortunately my host can't take ssi. Do you know a free one that can?
|
|
|
11-17-2004, 06:29 AM
|
#8 (permalink)
|
|
Contributing Member
Join Date: 05-24-04
Location: Sydney, Australia
Posts: 479
|
free hosts always have their limitations
|
|
|
11-17-2004, 07:42 AM
|
#9 (permalink)
|
|
Inactive
Join Date: 10-13-03
Posts: 7,481
Latest Blog: None
|
At the moment your code says
Code:
<body>
<BR><BR><php include("http://robotwarsfansite.atspace.com/example/menu.htm") ?><BR>
</body>
Change that to
Code:
<body>
<BR><BR>
<?php include("http://robotwarsfansite.atspace.com/example/menu.htm")?>
<BR>
</body>
|
|
|
11-17-2004, 10:31 AM
|
#10 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,137
Latest Blog: None
|
And also to follow good convention
<?php include("http://robotwarsfansite.atspace.com/example/menu.htm"); ?>
If all instructions are on one line you don't need the ; - but it's good practice nonetheless 
|
|
|
11-19-2004, 06:40 AM
|
#11 (permalink)
|
|
Contributing Member
Join Date: 05-17-04
Location: London, United Kingdom
Posts: 1,200
Latest Blog: None
|
Thanks, but...
Quote:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<p><!--webbot bot="HTMLMarkup" startspan --><body>
<BR><BR>
<?phpinclude("http://robotwarsfansite.atspace.com/example/menu.htm">
<BR>
</body><!--webbot bot="HTMLMarkup" endspan -->
</p>
</body>
</html>
|
Unfortunately, the code <!--webbot bot="HTMLMarkup" startspan --> has been added by frontpage. When I remove it the URL is spilt into design view. Though it doesn't show on the final layout, it still gets confusing. What should I do, or doesn't the 'Webbot bot' bit matter?
|
|
|
11-19-2004, 09:31 PM
|
#12 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,137
Latest Blog: None
|
No - you do not need the following lines
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<!--webbot bot="HTMLMarkup" startspan --><body>
</body><!--webbot bot="HTMLMarkup" endspan -->
Notice there are 2 <body> tags - one set removed as per above.
|
|
|
11-20-2004, 09:28 AM
|
#13 (permalink)
|
|
Contributing Member
Join Date: 03-06-04
Location: NY, CT, CA, AZ
Posts: 574
Latest Blog: None
|
PHP includes should be...
Code:
<?php require("yourincludefile.html"); ?>
Make sure you enable includes in your .htaccess file... add the following to the top...
Code:
Options Includes
AddType text/x-server-parsed-html .shtml
You can add more extensions by listing them in sequence...
Code:
Options Includes
AddType text/x-server-parsed-html .shtml .shtm .html .htm
AddType application/x-httpd-php .php
__________________
"90% of the game is half mental."
--Yogi Berra
Elizabeth Arden
Last edited by FGTH : 11-20-2004 at 09:38 AM.
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:38 AM.
© Copyright 2008 V7 Inc
|
|