Commit e8ad67b0 authored by Ryan Wade's avatar Ryan Wade

Changed Hard Coded values to read Global Vars. The Vars in question are...

Changed Hard Coded values to read Global Vars.  The Vars in question are derived from a table which is currently standing in for the SQL database
parent 1ab140f1
<div id="body">
<div id="bodyBox" class="bodyText">
This is text. It is the wonderful text that makes up the body. The body, that is, the content of a page. All of its eloquence laid out to bear. Dirty laundry drifting in the wind. Exposed to all the snooping robots and spambots scouring the web for tasty prey.
<?php
//This is text. It is the wonderful text that makes up the body. The body, that is, the content of a page. All of its eloquence laid out to bear. Dirty laundry drifting in the wind. Exposed to all the snooping robots and spambots scouring the web for tasty prey.
echo $_GLOBAL["pageHTML"];
?>
</div>
</div>
\ No newline at end of file
<?php
$id = $_GLOBAL["pageId"];
$title = $_GLOBAL["pageTitle"];
$link = "<a class='breadcrumbLink' href='viewpage.php?id=".$id."'>".$title."</a>";
$id = 3;//SQL get parent id
while($id != 0)
$bc_id = $_GLOBAL["pageId"];
$bc_title = $_GLOBAL["pageTitle"];
$bc_link = "<a class='breadcrumbLink' href='viewpage.php?id=".$bc_id."'>".$bc_title."</a>";
$bc_id = $_GLOBAL["SQL"][$bc_id][1];//SQL get parent id
while($bc_id != -1)
{
$title = "Parent Page Title";//SQL get Title
$link = "<a class='breadcrumbLink' href='viewpage.php?id=".$id."'>".$title."</a>"." > ".$link;
$id = 0;//SQL get parent id
$bc_title = $_GLOBAL["SQL"][$bc_id][2];//SQL get Title
$bc_link = "<a class='breadcrumbLink' href='viewpage.php?id=".$bc_id."'>".$bc_title."</a>"." > ".$bc_link;
$bc_id = $_GLOBAL["SQL"][$bc_id][1];//SQL get parent id
}
?>
......@@ -15,7 +15,7 @@
<div id="breadcrumbBox">
<div id="breadcrumbText">
<?php echo $link;?>
<?php echo $bc_link;?>
</div>
</div>
</div>
\ No newline at end of file
<nav id="navBar">
<?php
if(isset($_GLOBAL["pageId"]))
$postId=$_GLOBAL["pageId"];
else
$postId=0;
$pages = [[1,"Page1"],[2,"Page2"],[3,"Page3"],[4,"Page4"]];
$navbar = " <ul>\r\n";
foreach($pages as $page)
function SQL_QUERY_PARENT_ID($t_id,$t_SQL)
{
$id=$page[0];
if($id==$postId)
$linkType="NavSelected";
else
$linkType="NavLink";
$title=$page[1];
$navbar .= " <li id='NavId".$id."' class='".$linkType."'><a href='viewpage.php?id=".$id."'>".$title."</a></li>\r\n";
$i=0;
foreach($t_SQL as $page)
{
if($page[1]==$t_id||($t_id==0&&$page[0]==0))
{
$Query[$i]=$page;
$i++;
}
}
if(!isset($Query))
return null;
return $Query;
}
$navbar .= " </ul>\r\n";
echo $navbar;
function createLevel($level,$t_SQL,$t_select,$t_depth)
{
if(!isset($level)||$t_depth == 0)
return "";
$navbar = " <ul>\r\n";
foreach($level as $page)
{
$id=$page[0];
if($id==$t_select)
$linkType="NavSelected";
else
$linkType="NavLink";
$title=$page[2];
$navbar .= " <li id='NavId".$id."' class='".$linkType."'><a href='viewpage.php?id=".$id."'>".$title."</a>\r\n";
if($page[0]!=0)
$navbar .= createLevel(SQL_QUERY_PARENT_ID($page[0],$t_SQL),$t_SQL,$t_select,$t_depth-1);
$navbar .= " </li>\r\n";
}
$navbar .= " </ul>\r\n";
return $navbar;
}
$nav_SQL = $_GLOBAL["SQL"];
$nav_id = $_GLOBAL["pageId"];
$level = createLevel(SQL_QUERY_PARENT_ID(0,$nav_SQL),$nav_SQL,$nav_id,2);
echo $level;
?>
<!--
<ul>
......
<?php
$pages = [[0,-1,"Home" , null , null ,"This is the homepage :)"],
[1, 0,"Page1" ,"Page 1 Description" , "./title.jpg" ,"This is page 1 html content"],
[2, 0,"Page2" ,"Page 2 Description" , "./title.jpg" ,"This is page 2 html content</br><button>Logon</button>"],
[3, 0,"Page3" ,"Page 3 Description" , "./title.jpg" ,"This is page 3 html content"],
[4, 0,"Page4" ,"Page 4 Description" , "./title.jpg" ,"This is page 4 html content"],
[5, 1,"Page5" , null , null ,"This is SUB page 5 html content"],
[6, 1,"Page6" , null , null ,"This is SUB page 6 html content"],
[7, 1,"Page7" , null , null ,"This is SUB page 7 html content"]
];
$_GLOBAL["SQL"] = $pages;
if(isset($_GET["id"]))
$_GLOBAL["pageId"] = $_GET["id"];
else
......@@ -8,36 +19,26 @@
case -1:
$_GLOBAL["pageTitle"] = "Sitemap";
break;
case 0:
$_GLOBAL["pageTitle"] = "Home";
break;
default:
$_GLOBAL["pageTitle"] = "Page Title".$_GLOBAL["pageId"];
$_GLOBAL["pageDesc"] = "This is a description of your page. use it wisely as you only have a limited amount of space";
$_GLOBAL["pageImg"] = "./title.jpg";
$_GLOBAL["pageTitle"] = $pages[$_GLOBAL["pageId"]][2];
if(isset($pages[$_GLOBAL["pageId"]][3]))
{
$_GLOBAL["pageDesc"] = $pages[$_GLOBAL["pageId"]][3].": This is a description of your page. Use it wisely as you only have a limited amount of space";
$_GLOBAL["pageImg"] = $pages[$_GLOBAL["pageId"]][4];
}
$_GLOBAL["pageHTML"] = $pages[$_GLOBAL["pageId"]][5];
break;
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="sitemap.css">
<link rel="stylesheet" type="text/css" href="home.css">
<link rel="stylesheet" type="text/css" href="global.css">
<link rel="stylesheet" type="text/css" href="header.css">
<link rel="stylesheet" type="text/css" href="nav.css">
<link rel="stylesheet" type="text/css" href="title.css">
<link rel="stylesheet" type="text/css" href="breadcrumb.css">
<?php
switch ($_GLOBAL["pageId"])
{
case -1:
echo " <link rel=\"stylesheet\" type=\"text/css\" href=\"sitemap.css\">\r\n";
break;
case 0:
echo " <link rel=\"stylesheet\" type=\"text/css\" href=\"home.css\">\r\n";
break;
default:
break;
}
?>
<link rel="stylesheet" type="text/css" href="body.css">
<link rel="stylesheet" type="text/css" href="footer.css">
</head>
......@@ -53,9 +54,6 @@
case -1:
include "./sitemap.php";
break;
case 0:
include "./home.php";
break;
default:
include "./body.php";
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment