View Single Post
  #5 (permalink)  
Old 02-26-10, 07:29 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Quote:
Originally Posted by adr2020 View Post
I even changed (index.php) code line to define the path: $bodycontent = "includes/index.htm";

and changed (bodycontent.php) code line to use only the variable: <?php include $bodycontent; ?>

It still doesnt show the contents of where the variable $bodycontent is referring to 'index.htm'

Any idea how to resolve this?

Thanks for your advise Jerry (or anyone from the Hotscripts Forum Community)
What you are saying here doesn't seem to make a lot of sense yet.

This is what the contents of my "index.htm" file looks like:
HTML Code:
<h1>This is index.htm</h1>


I have a directory called "test" and in the "test" directory I have a directory called "includes".
Also in the "test" directory I have the file called "index.php" which has my code in it and there should also be a file called "
bodycontent.php".
And in the "includes" directory I have the file called "index.htm".
Also in the "includes" directory there should be the files called "
top.htm", "left.htm" and "bottom.htm".
I don't understand what the file "bodycontent.php" is used for.

This is the contents of the file "index.php".
PHP Code:

<?php
$pagetitle 
"Mysite - Home";
$bodycontent "index.htm";
include(
"bodycontent.php");
?>
<html>
<head>
<?php echo "<title>$pagetitle</title>"?>
</head>
<body>
<?php include("includes/top.htm"?>
<table>
<?php include("includes/left.htm"); ?> 
<?php include("includes/$bodycontent"); ?>
</table>
<?php include("includes/bottom.htm"?>
</body>
</html>
But the contents of "index.php" probably should look like this:
PHP Code:

<?php
$pagetitle 
"Mysite - Home";
$bodycontent "index.htm";
?>
<html>
<head>
<?php echo "<title>$pagetitle</title>"?>
</head>
<body>
<?php include("includes/top.htm"?>
<table>
<?php include("includes/left.htm"?>
<?php 
include("includes/$bodycontent"); ?>
</table>
<?php include("includes/bottom.htm"?>
</body>
</html>
If I were to set this up, I would have the file "index.php" in my root directory.
Also in my root directory I would have a directory called "includes".
And in my "includes" directory I would have the files "top.htm", "left.htm", "bodycontent.htm" and "bottom.htm".
And then the contents of my "index.php" file would look like this:
PHP Code:

<?php
$pagetitle 
"Mysite - Home";
$bodycontent "bodycontent.htm";
?>
<html>
<head>
<?php echo "<title>$pagetitle</title>"?>
</head>
<body>
<?php include("includes/top.htm"); ?>
<table>
<?php 
include("includes/left.htm");
include(
"includes/$bodycontent"); 
?>
</table>
<?php include("includes/bottom.htm"?>
</body>
</html>
Ok, I see other problems.
Look at your includes.
They are missing some punctuation.
They are missing the semicolons.
I don't see why I didn't see that before.
My bad.
__________________
Jerry Broughton

Last edited by job0107; 02-26-10 at 08:32 AM.
Reply With Quote