Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-01-2007, 01:54 PM PHP Switch ~ Pages
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
Basically I got a few pages:

Index.php
Network.php
Order.php
contact.php

I want those pages to use the get function throughout the page.

Example:

http://www.mysite.com/index.php?=Network (and have the network id be the network.php page) so the page would just jump off the index. More of a personal thing.

Thanks:

X
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
 
Register now for full access!
Old 03-01-2007, 02:13 PM Re: PHP Switch ~ Pages
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
You mean jump to that page or include it?

Jump:
PHP Code:
<?php
if(isset($_GET['id'])){
Header('Location:'.$_GET['id'].'.php');
}else{
// Normal index page
}
?>
Include:
PHP Code:
<?php
if(isset($_GET['id'])){
include_once(
$_GET['id'].'.php');
}
?>
Note:
Linking goes like this:
Index.php?id=Network
!Case sensitive!

Regards,
Insensus
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 03-05-2007, 09:22 AM Re: PHP Switch ~ Pages
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
Perhaps a example? As i've tested this code, and it doesn't seem to work. I just basically like I said above to have the index, jump to those pages. But keep my header, and footer information. without having to reload them.

So would the switch be layed out something like this?

PHP Code:
switch ($page):
case 
0:
   echo 
"?page=network.php";
   break;
case 
1:
   echo 
"?page=contact.php";
   break;
case 
2:
   echo 
"?page=order.php";
   break;
default:
   echo 
"index.php";
endswitch; 
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
Old 03-05-2007, 09:32 AM Re: PHP Switch ~ Pages
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
Uhm. No.

I'll state you a small example:

PHP Code:
<html>
<head>
<title>Test page</title>
</head>
<body>
<div id="Header">Your header goes here</div>
<div id="Content">
<?php
switch($_GET['page']){
case 
1:
include_once(
'news.php');
break;
case 
2:
include_once(
'galleries.php');
break;
case 
3:
include_once(
'links.php');
break;
default:
include_once(
'home.php');
break;
}
?>
</div>
</div id="Footer">Your footer goes here</div>
</body>
</html>
Now you can link to:
'News': 'index.php?page=1'
'Galleries': 'index.php?page=2'
'Links': 'index.php?page=3'

If no page is supplied, you get the 'Home' page.

Regards,
Insensus
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 03-05-2007, 11:38 AM Re: PHP Switch ~ Pages
memberpro's Avatar
Super Talker

Posts: 143
Trades: 0
When you supply variables to a webpage via the GET method.. you are reloading the entire page.

Say you click on a link with an address of 'index.php?index=page2.php' ... the index.php page still completely reloads, but will now just include a different file for the content.

You state in your post that you want to keep the header and footer information the same... Am I understanding you correctly, or is the solution provided what you are looking for?
__________________

Please login or register to view this content. Registration is FREE
- step-by-step learn how to design, create and install your own website in hours...not days.
Please login or register to view this content. Registration is FREE
was never so easy.
memberpro is offline
Reply With Quote
View Public Profile
 
Old 03-05-2007, 02:27 PM Re: PHP Switch ~ Pages
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
Quote:
Originally Posted by memberpro View Post
When you supply variables to a webpage via the GET method.. you are reloading the entire page.

Say you click on a link with an address of 'index.php?index=page2.php' ... the index.php page still completely reloads, but will now just include a different file for the content.

You state in your post that you want to keep the header and footer information the same... Am I understanding you correctly, or is the solution provided what you are looking for?
Basically my page is layed out like such. Top(header)right(links)bottom(footer)

The only thing I want to change is the left side were my information is stored on each relaod. :P I forgot the links part above.
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
Old 03-05-2007, 02:29 PM Re: PHP Switch ~ Pages
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
Then you should use frames or AJAX to change only a part of a page.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Old 03-05-2007, 04:16 PM Re: PHP Switch ~ Pages
memberpro's Avatar
Super Talker

Posts: 143
Trades: 0
I agree...Use AJAX/javascript along with an iframe to do what you are looking for.
__________________

Please login or register to view this content. Registration is FREE
- step-by-step learn how to design, create and install your own website in hours...not days.
Please login or register to view this content. Registration is FREE
was never so easy.
memberpro is offline
Reply With Quote
View Public Profile
 
Old 03-07-2007, 08:28 AM Re: PHP Switch ~ Pages
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
Haha i'm to lazy to implement some JS or AJAX. So i'll just stick with the other way, to just have the page reload. But thanks for the idea, i'll keep it in mind.
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
Old 03-24-2010, 11:04 AM Re: PHP Switch ~ Pages
Junior Talker

Posts: 1
Name: Matthew Stone
Trades: 0
I have a similar question: OK let me try to make myself clear here.

I have two parts to a website a general side and another part to the site called photography.

Both parts to the site share the same navigation.

For one of the links in the side navigation i have a link called FAQ's.

Rather then have 2 different faq links shown I want to create a conditional that if your on the general side of the site go to the general faq and if your on the photography side go to the photo faq.

so something like this i think:

if (gen1.php, gen2.php, gen3.php)
{ go to this gen-faq.php page }

else if (photo1.php, photo2.php)
{go to this photo-faq.php page}

Im not sure if this is the way I would even go around doing this. BUT COULD SOME ONE PLEASE HELP ME WITH THIS PROBLEM

thanks
msdesigns1 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP Switch ~ Pages
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36967 seconds with 12 queries