I have been doing lessons in PHP & mySQL, I mean painstaking lessons and it seems to be paying off little by little, yet i'm still havingproblems trying to get a dynamic site going with just php.
Lets say it creat an index.php page and have a include files, let's say header.php and footer.php, but also navigationbar.php, now the navigationbar.php file has all my links to let's say, bio.php, aboutus.php, info.php and so on.
My Question is the following:
what is the required code so that each time i click on a link I CALL MY DESIRED PAGE SUCH AS bio.php, aboutus.php and so forth, i guess not leaving index.php at all but instead calling each page and having it land or reflect in a specific area.
My buddy who is a master at php, but a dummy at explaining it wrote a piece of code that sheesh, confused the hell out me,
I went and did a tutorial on Object Oriented Programming and it was fabulous, yet i can only say that i have understood it only a 90%, i have a basic orientation on php, can anyone please come to the rescue, here is the piece of code he wrote, so that someone may make use of it.
----------------------------Master PHP CODE---------------------------------
<?php
function my_header() {
echo "<b>Welcome</b>";
}
function my_footer() {
echo "This site is Dynamic";
}
function my_left(&$nav) {
for ($x = 1; $x < count($nav); $x++)
echo "<a href='$PHP_SELF?cont=$x'>" . $nav[$x][1] . "</a><br>";
}
?>
---------------------------||------------------------------||--------------------------
THIS IS THE INDEX.PHP FILE WHICH INCLUDES THE ABOVE MASTER PHP.CODE
---------------------------||------------------------------||--------------------------
<?PHP
// main page
include ("master_page.php");
$nav_lt = array (
array("homepage.html", "Home page"),
array("content1.php", "display content1"),
array("content2.php", "display content2"),
array("content3.php", "display content3")
);
$cont = $_REQUEST['cont'];
if (empty($cont)) $cont = 0;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN
"http://www.w3.org/TR/html4/loose.dtd"">
<html>
<head>
<title>Welcome page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="tcm juncture" content="main page">
</head>
<body bgcolor="darkYellow" text="darkMagenta">
<table border="1" bgcolor="#E5D0F3" width="100%">
<thead bgcolor="#DAF23E">
<tr>
<th scope=col colspan="5"><?php my_header(); ?></th>
</tr>
</thead>
<tfoot>
<tr><td colspan="3"><?php my_footer(); ?></td>
</tr>
</tfoot>
<tbody>
<tr>
<td><?php my_left($nav_lt); ?></td>
<td colspan="3"><?php include($nav_lt[$cont][0]); ?>
</td>
<td>right hand side</td>
</tr>
<tr>
<td>row 2 | column 1</td>
<td>row 2 | column 2</td>
<td>row 2 | column 3</td>
<td>row 2 | column 4</td>
<td>row 2 | column 5</td>
</tr>
<tr>
<td>row 3 | column 1</td>
<td>row 3 | column 2</td>
<td>row 3 | column 3</td>
<td>row 3 | column 4</td>
<td>row 3 | column 5</td>
</tr>
</tbody>
</table>
</body>
</html>
:glare: