Include Problem

  • Jako
  • Banned
  • Banned
  • Jako
  • Posts: 227

Post 3+ Months Ago

This is the code for one of my pages. The file I am trying to include is: rosternav.php. I believe I coded it right, but when I go to the page at http://jako.us/roster1.htm it doesn't work. This is the page for the file I want to be included, http://jako.us/rosternav.php
Code: [ Select ]
<HTML>
<HEAD>
<TITLE>Roster</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
BODY {
scrollbar-face-color:#59654D;
scrollbar-shadow-color: #000000;
scrollbar-highlight-color:#000000;
scrollbar-track-color:#DBDBC3;
scrollbar-arrow-color:#000000;
}
body,td,th {
    color: #000000;
    font-family: Verdana;
    font-size: 10px;
}
body {
    background-color: #DBDBC3;
    background-image: url();
    margin-left: 4px;
    margin-top: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
}
a:link {
    color: #59654D;
}
a:visited {
    color: #59654D;
}
a:hover {
    color: #59654D;
}
a:active {
    color: #59654D;
}
.style5 {font-family: Verdana}
.style7 {font-family: Verdana; font-weight: bold; }
-->
</style>
</HEAD>
<BODY>
<p>Name:</p>
<p>Tag:</p>
<p>Bio:</p>
<p><?
include "rosternav.php";
?></p>
</BODY>
</HTML>
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Roster</TITLE>
  4. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  5. <style type="text/css">
  6. <!--
  7. BODY {
  8. scrollbar-face-color:#59654D;
  9. scrollbar-shadow-color: #000000;
  10. scrollbar-highlight-color:#000000;
  11. scrollbar-track-color:#DBDBC3;
  12. scrollbar-arrow-color:#000000;
  13. }
  14. body,td,th {
  15.     color: #000000;
  16.     font-family: Verdana;
  17.     font-size: 10px;
  18. }
  19. body {
  20.     background-color: #DBDBC3;
  21.     background-image: url();
  22.     margin-left: 4px;
  23.     margin-top: 4px;
  24.     margin-right: 4px;
  25.     margin-bottom: 4px;
  26. }
  27. a:link {
  28.     color: #59654D;
  29. }
  30. a:visited {
  31.     color: #59654D;
  32. }
  33. a:hover {
  34.     color: #59654D;
  35. }
  36. a:active {
  37.     color: #59654D;
  38. }
  39. .style5 {font-family: Verdana}
  40. .style7 {font-family: Verdana; font-weight: bold; }
  41. -->
  42. </style>
  43. </HEAD>
  44. <BODY>
  45. <p>Name:</p>
  46. <p>Tag:</p>
  47. <p>Bio:</p>
  48. <p><?
  49. include "rosternav.php";
  50. ?></p>
  51. </BODY>
  52. </HTML>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Try changing the file extension of http://jako.us/roster1.htm to php so that the include code will be run on the server. Most servers aren't set up to parse regular htm files for php statements.
  • Mr Smith
  • Graduate
  • Graduate
  • Mr Smith
  • Posts: 150
  • Loc: Birmingham, England

Post 3+ Months Ago

the file/page you want the 'include' file to show in needs to be in .php instead of .htm:

Code: [ Select ]
http://jako.us/roster1.htm


change it to read

Code: [ Select ]
http://jako.us/roster1.php


with the include file:

Code: [ Select ]
<?php include ('rosternav.php'); ?>


change the extension to .inc
(this saves confusion, and separates your files for easier editing etc.)

Code: [ Select ]
]<?php include ('rosternav.inc'); ?>


this should now work.

Joe
  • Jako
  • Banned
  • Banned
  • Jako
  • Posts: 227

Post 3+ Months Ago

Got it to work now, thanks for all of your help

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 100 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.