Forum Moderators: coopster
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}
?>
<?php
//set the page handling var, and put a default (in this example I have used '1')
$page = ((isset($_GET['Page1']) && !empty($_GET['Page1'])) ? strip_tags($_GET['Page1']) :'1');
//load content depending on value in $page
if($page == 1){
include("path/to/dir/page1.php");//<- this *should* be the default page IF the $_GET isn't set...
}
elseif($page == 2){
include("path/to/dir/page2.php");
}
elseif($page == 3){
include("path/to/dir/page3.php");
}
else{
//set an error handler, though in theory this should be invoked, but always good to handle errors
include("path/to/dir/error_page.php");
}
?>
<?php
$template="
<html>
<head>
<title>#title#</title>
</head>
<body>
#content#
</body>
</html>
";
if(isset($_GET["page"]))
{
$page=$_GET["page"];
}
else
{
die("no page requested");
}
/*
now remember your html template is on variable named $template
*/
if($page=="page1")
{
$title="Title of Page 1";
$content= "content for page 1 here, you can even call a function which returns you content, loads of it";
}
elseif($page=="page2")
{
$title="Title of Page 2";
$content= "content for page 2 here";
}
elseif($page=="page3")
{
$title="Title of Page 3";
$content= "content for page 3 here";
}
elseif($page=="contact")
{
$title="Contact US";
$content= "make your contact form here";
}
else
{
$title="Page not Found";
$content="We do not have this page on our site";
}
/*
now we simply replace the markers in our template with these variables
*/
$template=str_replace("#title#",$title,$template);
$template=str_replace("#content#",$content,$template);
echo $template;
die();
?>
so you can link to them like this
example.com/index.php?page=page1
want to Design a Index page that displays files that are inside a folder...
....
as its a Apache question also
....
make the background black etc
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Directory Listing</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
html{
background-color:black;
}
body{
color:white;
width:800px;
margin:0 auto;
font-family:Arial,Helvetica;
}
table{
border:2px solid green;
margin:0 auto;
background-color:darkslategray;
font-family:"Courier New";
}
td{
padding:0 8px;
}
td a{
margin-left:6px;
color:darkturquoise;
font-family:"Times New Roman",Times;
}
td a:hover{
text-decoration:none;
}
th a,th a:visited{
color:chartreuse;
}
#content{
width:800px;
text-align:left;
}
img{
border:0;
}
</style>
<script type="text/javascript">
window.onload = function () {
var i,
links = document.getElementsByTagName('a'),
div = document.getElementById('content'),
h2 = document.createElement('h2');
for (i = 0; i < links.length; i++) {
if (!links[i].title.length) {
links[i].title = links[i].href.match(/[^\/]+\/?$/);
}
}
//h2.style.color = 'red';
div.insertBefore(h2, div.childNodes[0]);
h2.appendChild(document.createTextNode('Index Of: '+ window.location.pathname));
};
</script>
</head>
<body>
<div id="content">
<h1 style="color:red;">endPage.html</h1>
</div>
</body>
</html>
Options All
IndexOptions FancyIndexing NameWidth=40 FoldersFirst IconsAreLinks HTMLTable SuppressHTMLPreamble
HeaderName /fancyIndexingFiles/header.html
ReadmeName /fancyIndexingFiles/endPage.html
AddDescription "<a href=\"http://www.google.com/search?hl=en&q=.rar file\" title=\".rar file info\">WINRAR File</a>" .rar
AddDescription "PHP File" .php
AddDescription "Plain Text File" .txt
AddDescription "HTML File" .html .htm
AddAlt "Icon" *.html *.php *.txt *.xml *.csv
AddAlt "rar file icon" *.rar
AddIcon /fancyIndexingFiles/RAR_icon_small.gif .rar
AddDescription "Could be a folder?" *
IndexIgnore footer.html images
IndexIgnore *.html images
AddDescription "Ramses Folder" Ramses
[TXT]AboutUs.html 29-Oct-2010 18:34 1.1K
[TXT]Contacts.html 09-Oct-2010 15:19 1.5K
[ ]HTBHA.rar 23-Oct-2010 21:43 735K
[DIR]Images/ 28-Oct-2010 20:31 -
[TXT]Projects.html 23-Oct-2010 21:41 1.1K
[TXT]UnderConstruction.html 23-Oct-2010 21:43 782
[ ]Year.php 08-Feb-2010 08:10 20
[ ]include.php 04-Nov-2010 12:35 417
[TXT]indexX.html 26-Oct-2010 07:03 2.8K
[TXT]style.css 30-Oct-2010 11:15 1.6K
[ ]test.php 30-Oct-2010 10:30 624