PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 20th, 2003, 01:26 AM
diamondazza diamondazza is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 diamondazza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy internal php navigation

i have my index page set up with the menu like this:
<?
switch ($page) {
case "guide":
include('guide/guide.inc');
break;
case "bands":
include('db/index.php');
break;
case "ticks":
include('ticks/ticks.php');
break;
case "chat":
include('bands/bands.php');
break;
default:
include('content.php');
}
?>
when i click on "guide" it loads guide.inc into the browser within the index page, bit like a iframe tag, now on the guide.inc page i have another seperate menu. my prob is this, when i click on a menu item in the guide.inc page the index page defualts back to the content.php, i want it to be able to load it within the index page.

guide.inc
search || whatshot || lastweek || <--guide.inc menu

the links are set up like this:
a href="index.php?page=search.php"
etc etc...
basically i want it to act a bit like the iframe tag
i hope this makes sence..please help!
thanx

Reply With Quote
  #2  
Old October 21st, 2003, 04:29 PM
Sentic Sentic is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 7 Sentic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
just pass an extra argument with your url's.

So if u're on 'guide', all links (search, whatshot, etc) have an extra argument...'page'

So you links should look liks this (or like it...) :
a href="index.php?page=guide&subpage=search.php"

Yoy could drop the '.php' extention in a switch struc on the guide-page if you like.

Good luck

Reply With Quote
  #3  
Old October 21st, 2003, 04:42 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Your problem is that a Url like this: href="index.php?page=search.php" is going to hit your code:
PHP Code:
<? 
switch ($page) { 
case 
"guide"
include(
'guide/guide.inc'); 
break; 
case 
"bands"
include(
'db/index.php'); 
break; 
case 
"ticks"
include(
'ticks/ticks.php'); 
break; 
case 
"chat"
include(
'bands/bands.php'); 
break; 
default: 
include(
'content.php'); 

?>

The above code is going to find that there is no search.php in the switch statement so it will go to the default include('content.php');

What you can do is, make the link: href="index.php?page=guide&sub=search"

Now all you have to do is create another switch statement inside guide.inc.
PHP Code:
<? 
switch ($sub) { 
case 
"search"
include(
'search.php'); 
break; 
default: 
break;

?>
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #4  
Old October 21st, 2003, 04:45 PM
Sentic Sentic is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 7 Sentic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
..i think i allready told....

i also think u should use the following implementation

switch(trim($page)) { // $_GET['page'] is even way better!
case(guide):
etc....


On the 'sub'-pages u could use a switch again if u like

Reply With Quote
  #5  
Old October 21st, 2003, 04:55 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Yes, our explainations were similar... I just thought I would elaborate a little in case our friend needed a little more detail.

Also, you are right about using the superglobal arrays. If diamondazza wants to find out more about that topic it would be a good idea to check out this thread: http://www.devarticles.com/forum/sh...=&threadid=4391

Reply With Quote
  #6  
Old October 21st, 2003, 05:05 PM
Sentic Sentic is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 7 Sentic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
..or by reading this nice story

Reply With Quote
  #7  
Old October 21st, 2003, 05:32 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Yeah, it doesn't get any better than that.

Reply With Quote
  #8  
Old October 22nd, 2003, 05:56 AM
diamondazza diamondazza is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 diamondazza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking YOU RIPPER

i have posted this same question all around the web.. you guys are the only ones to give me a good answer with links to tutorial pages!! im workin on my web page now with what you lot have said! if it works ill buy yas all a drink!! im pretty lame at php, cant seem to get my head around it, great to know theres help here!
cheers guys

Reply With Quote
  #9  
Old October 22nd, 2003, 10:10 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
No problem... hope it works out for you. If not we are always here to help.

Reply With Quote
  #10  
Old October 23rd, 2003, 05:02 AM
diamondazza diamondazza is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 diamondazza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
*sigh*

well...i set it all up, used superglobals and all it seem to do is reload that poxy defualt content!! is there any other way i could code the menu? i understand what you guys were tellin me but ARGH!! so...i think its beer oclock!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > internal php navigation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway