This would be your php page that displays the text files and has links to others.
PHP Code:
<?php
$page_on = $_GET['page'];
$ext = ".txt";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
if (isset($page_on)) {?>
<?php
if (file_exists($page_on . $ext)) {
?>
<title><?php echo $page_on; ?></title>
</head>
<body>
<?php
$file_contents = file_get_contents($page_on . $ext);
echo $file_contents;
?>
</body>
</html>
<?php
} else {
?>
<title>Invalid Request</title>
</head>
<body>
<h1>Invalid Page Request Please return to the previous page.</h1>
</body>
</html>
<?php }?>
<?php } else { ?>
<title>Normal Page Title</title>
</head>
<body>
<h1>My Page</h1>
<p>Page Content</p>
<a href="?page=getthis">Sample link to Load File "getthis.txt"</a>
</body>
</html>
<?php }?>
In that same directory put your text files and link to them with <a href="?page=getthis">
Where the name of the text file is after the "?page=" without the extenstion. The $_GET gets the the name after what the "page=" has. So if you want to change how the address bar appears change the link name to something like
<a href="?youarehere=getthis">
and $_GET['youarehere'];
If you don't care about the extensions you can change all the ext's to ".txt" or remove them all together and write the links to these with the .txt in it. For example
<a href="?youarehere=getthis.txt">
Make sense?
If any PHP coders see any things I should change with my coding please let me know as well. Thanks.
Bookmarks