HTML Help Forum HTML Help
Please Search for the answer to your question before asking it! Thanks.
 

Navigation Help...No Frames on Page
Post a Reply to this Topic Ask a New Question
Click here to go to the original topic
       HTML Help Forum -> Javascript
View previous topic :: View next topic  
Author Message
grazzt



Joined: 08 Nov 2005
Posts: 9

Posted: Sun Nov 13, 2005 8:17 am     Navigation Help...No Frames on Page  

I have searched hi and low for help with this. I have a website here ScottyOWeb. I have this set up using PHP and includes to avoid using Frames. The basic sctructure is below. I have 5 sections of the document: Header, Left/Right Navs, Footer and the Body. The Body is listed in BOLD below. This is the only section of the page I really want to change from one link to another. Here is my problem...

Every link I create for my homepage has to have a PHP file and an include file. What I want to do is set one PHP file and everytime someone hits a link, it creates a variable to find this file and place it into the BOLD statement below. I hope this isn't confusing.

Grazzt


<body>
<table>
<tr>
<?php include("includes/header.inc"); ?>
</tr>
<tr>
<?php include("includes/left.inc"); ?>

<?php include("includes/index.inc"); ?>

<?php include("includes/right.inc"); ?>
</tr>
<tr>
<?php include("includes/footer.inc"); ?>
</tr>
</table>
<br>
</body>


This is the closest thing I found to what I am looking for, but it uses frames.
http://www.htmlcodetutorial.com/help/viewtopic.php?p=8691&highlight=one+control#8691[url][/url]


Corey Bryant



Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

Posted: Sun Nov 13, 2005 8:55 am      

I think you are looking for somethig like
Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<table>
<tr>
<td>
<?php include("includes/header.inc"); ?>
</td>
</tr>
<tr>
<td>
<?php include("includes/left.inc"); ?>

<?php include("includes/index.inc"); ?>

<?php include("includes/right.inc"); ?>
</td>
</tr>
<tr>
<td>
<?php include("includes/footer.inc"); ?>
</td>
</tr>
</table>

</body>

</html>
chrisxkelley



Joined: 07 Dec 2004
Posts: 246

Posted: Sun Nov 13, 2005 10:44 am      

Corey, I believe he means that he wants the page to change every time he hits a link.

In this case, you need to use a simple url $_GET[] variable with a switch/case statement.

put this code where the main include statement is:

Code:
<?PHP

switch ($_GET[page]){

     case "home":
          include 'home.inc';
     break;

     case "about":
          include 'about.inc';
     break;

     default:
          include 'home.inc';
     }
?>


and your hyperlink:
Code:
<a href="index.php?page=home">Home</a>


It's quite simple, really. all you have to do is add a variable to the url in your hyperlink, and that script will get the variable from the url (in this case I called the variable "page"), and the variables value, and it will include another page based on that.

How to edit this for yourself:

Code: switch($_GET[page]){
leave this line alone. it tells php to get the variable on the url called page.

Code:
case "home":
     include 'home.inc';
break;

for every page you want to change, you will need a basic structure like this. it's basically asking, "Does the switch match this case (home)? If so, we'll excecute the code until we get to the break; statement."

Code:
default:
     include 'home.inc';
break;

This says if the variable doesnt meet any of the above requirements, to include home.inc. Its the "if all else fails" of switch/case statements.

Then for your url to get to the next page, do something like this:

Code:
<a href="index.php?page=home">Home</a>


This will send the page variable with the value "home" to the url, and when the index page executes, it will run the switch/case with the value "home", therefore including 'home.inc'.

So, just change the value of page to whatever page you want to go to. Then for every variable value you have, make another case statement in your switch/case script.


I hope you found this useful, let me know if you have any trouble.

Cheers,
Chris
grazzt



Joined: 08 Nov 2005
Posts: 9

Posted: Sun Nov 13, 2005 1:58 pm     THANKS!!  

Thanks a lot. This seemed to work. What I wanted is to main the look of the site and load the links of interest in the center of the screen. I have attached the code below and for how I used the "Get" statement.

Grazzt

PS. If you have another suggestion I would would apprieciate it. Thanks



Code:
<html>
<link rel=stylesheet href="mystyles.css" type="text/css">
<head>
<title>Scotty O's Poker Web</title>

</head>
<body>
<table border="0" align=left cellpadding="5" cellspacing="0" width="100%">
 <tr>
   <?php include("includes/header.inc"); ?>
 </tr>
 <tr>
   <?php include("includes/left.inc"); ?>

  <td valign="TOP">
   <?php
     switch ($_GET[page])
     {
     case "index":
          include 'includes/index.inc';
     break;
     case "pointsystem":
          include 'includes/pointsystem.inc';
     break;
     case "whatisit":
          include 'includes/whatisit.inc';
     break;
     case "whenisit":
          include 'includes/whenisit.inc';
     break;
     case "howtogetin":
          include 'includes/howtogetin.inc';
     break;
     case "schedule2005":
          include 'sopc/schedule2005.html';
     break;
     case "schedule2006":
          include 'sopc/schedule2006.html';
     break;
     case "leaderboard":
          include 'sopc/leaderboard.html';
     break;
     case "rackbackprogram":
          include 'includes/rakebackprogram.inc';
     break;
     default:
          include 'includes/index.inc';
     }
   ?>
  </td>

   <?php include("includes/right.inc"); ?>
 </tr>
 <tr>
   <?php include("includes/footer.inc"); ?>
 </tr>
</table>
   <br>
</body>
</html>
 
 
DARFUR
HOSTING / DESIGN
MAKE MONEY

       HTML Help Forum -> Javascript
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group