Register


Active : 1209
Logged in : 482
Time: 14:30 KST

User Streams
41 online (4 live)
Home | Forum | VODs | Liquibet | Fantasy | Blogs | Liquipedia | Articles | Store
Search TeamLiquid.net
Starcraft Progaming News
PokerStrategy.com TSL
Backseat Broodwar - Vol. 4
[PL] Bottom of the Barrel
Liquipedia Strategic Q&A …
PREMONITION
Featured Threads
TL User Locations
Funny Quotes from TL's I…
Recommended VODs of rece…
Small Vod Thread.
All-Time Pro Scene Music
General Forum
Random pics that make yo…
Myers-Briggs Test
Anime Discussion Thread
[\m/] Heavy Metal Thread
"The League"
Starcraft 2 Forum
Beta pushed back to 2010…
Pay to Play?
Roach Burrow Movement? (…
ELO rating games instead…
Sensor Tower — your thou…
Starcraft: Brood War Forum
Starcraft AI
[Fantasy] PL 09-10 R1 Di…
Most Proleague Wins Over…
[CSL+] News and Announce…
Nada's Body
Starcraft Tournaments and Leagues
[SPL] Woongjin Stars vs …
[SPL] eSTRO vs Air Force…
SC For Life LAN [D.C Area]
[CSL+] Duke versus Georg…
[AUS] State Seeding Tour…
Starcraft Strategy Forum
[Guide] The Stove
[Q] Nub PvP questions.
race picking
[H]Prevent Sair/Reaver E…
[Q] Turtle Zerg, ZVP
Sports & Games Forum
Strikeforce: Fedor vs Ro…
Developing a Robot Fight…
Dungeon Fighter Online O…
NBA 09-10: The Roundball…
Dragon Age
Blogs
Starcraft Replays
Kennigit - Rigel of Cyrosea
JeeP - Bj_Girl
S.C PJ - eSTRO_ret
NrT.Vapur - ToT)Eriador(
ESC White-Ra - RoX.Dimaga


Website Feedback

Closed Threads

IRC Updated
irc.quakenet.org #teamliquid

IRC Web Client
New to Team Liquid? Register here!

php question

rss
  Hot77.iEy, Jan 27 2009

I am coding navigation for a website and am using this code for every link in the navbar:

<?php
$default = "home.php";
$allowed = array (
'index',
'example',
);
if( isset( $_POST["P"] ) || isset( $_GET["P"] ))
{
$page = isset($_GET["P"]) ? $_GET["P"] : $_POST["P"];

if( in_array( trim ( $page ), $allowed ))
{
$file = $page . ".php";
if( (file_exists( $file )))
{
include( $file );
}
else
{
include( $default );
}
}
else
{
include( $default );
}
}
else
{
include( $default );
}
?>

Currently it searches for files in the folder where index.php. My question is how can I make it search for files in a sub folder? I have all my sub pages in 'pages' folder. Im guessing i have to change this line:

$file = $page . ".php";

But I dont know how to change the path correctly. I think the period in the middle means "current folder" which I have to change to reflect the path..

I got this from: http://scriptplayground.com/tutorials/php/PHP-Navigation/




Comments (4)




Calendar
Mo Tu We Th Fr Sa Su
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Live user streams:
skryoo1004
[ Show 2 non-featured ]

Upcoming events:  [ More ]
Nov 09  Strategic Q&A II
Nov 09  [PL] hite vs STX
Nov 09  [PL] SKT vs KT
Team Liquid Progaming Database

PokerStrategy.com TSL Forum
Teamliquid Starleague 2?
Suggestions for TSL2
Maps for TSL2 (and the f…
TSL2 with autoreplay?
Final Edits: Progaming Editorials
On The Shoulders of Giant…
Here To Stay
A Finale in Five
Masters of the Universe
Map of the Swarm
Power Rank: Progamer Rankings
1. Flash 6. Fantasy
2. Jaedong 7. Effort
3. Inter.Calm 8. Shine[Kal]
4. Stork[gm] 9. HyuK
5. Bisu 10. Kal
   Comments (238)
Poll
Most Overhyped?

Comments (177)      Older Polls


International Cyber Cup

Liquid Poker
Sitemap Contact Poker Forum

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2002-2009 Teamliquid.net. All Rights Reserved