Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-24-2010, 08:42 PM   PM User | #1
Pcfr43k
New Coder

 
Join Date: Jan 2010
Location: The Netherlands
Posts: 53
Thanks: 10
Thanked 0 Times in 0 Posts
Pcfr43k is an unknown quantity at this point
Array page set-page read

I have a PHP file that includes 2 other PHP files.
One creates a menu, the other displays content from files.

Now I'm trying to set an array with the menu and read this array with the displayer.

index:
PHP Code:
<?php
include("settings.php");

$p="";

echo 
"<html><head><title>".$company['name']."</title>";
echo 
"<link rel='stylesheet' type='text/css' href=".$theme['file']." />";
echo 
"</head><body>";

echo 
"<div id='menu'>";
include(
"menu.tpl");
echo 
"</div>";

echo 
"<div id='content'>";
include(
"content.tpl");
echo 
"</div>";

echo 
"</body>";
?>
Menu:
PHP Code:
<?php
//Open directory
$dir opendir("pages");

//List files in directory
while (($file readdir($dir)) !== false) {
  
//Files only filter
if ($file != '.' && $file != '..')
$file2 $file;

//Filename only filter
$info pathinfo($file2);
$filename =  basename($file2,'.'.$info['extension']);

//Empty result filter
if ($file2 != '')

//Display link with filename
echo "<ul id='navlinks'><li><A HREF=?p=" $filename ">" $filename "</A></li></ul>";
}

closedir($dir);
?>
Display:
PHP Code:
<?php

if (!isset($p)){
$c=file_get_contents("pages/Start.html");
} else {
$c=file_get_contents("pages/'.$p.'.html");
}
echo 
$c;

?>
I get the Start page, but setting another page shows also the Start page.
What am I doing wrong here?
Pcfr43k is offline   Reply With Quote
Reply

Bookmarks

Tags
array, content, menu

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:00 PM.


Advertisement
Log in to turn off these ads.