JaredRitchey Posted May 1, 2007 Share Posted May 1, 2007 I'm trying to get this chunk of code to work but I for some reason the code fails to respond correctly. What I'm after is the entire URI with or without file name to work properly as I comment here below. I'm almost certain its my syntax in the first line shown here. case "/index.html" || $P == "/" || "$P" == "/index.php": //I WANT THIS TO WORK //case "index.php": //ONLY THIS WORKS <?php $P=$_SERVER['REQUEST_URI']; switch ($P) { // Show Three columns with advertising block on right case "login.php"; case "privacy.php"; $data = 'threecolumn2.php'; break; // Show Three columns with NO advertising blocks case "/index.html" || $P == "/" || "$P" == "/index.php": //case "index.php": $data = 'threecolumn.php'; break; // TWO COLUMNS EVERY WHERE ELSE default: $data = 'twocolumn.php'; } ?> ~ Jared Quote Link to comment Share on other sites More sharing options...
JaredRitchey Posted May 1, 2007 Author Share Posted May 1, 2007 Forgot to explain what its for. The idea is to have a sort of variable template engine of sorts where some pages would load the third column while others would always be two columns. Some however would load a third column with a pair of advertising blocks. Each of the column files are external and use an include statement in the actual template. If I use this it doesn't work case "/index.html" || $P == "/" || "$P" == "/index.php": If I use the following its fine case "/index.php": case "/index.htm": case "/index.html": Quote Link to comment Share on other sites More sharing options...
trq Posted May 1, 2007 Share Posted May 1, 2007 <?php $P=$_SERVER['REQUEST_URI']; switch ($P) { // Show Three columns with advertising block on right case "login.php"; case "privacy.php"; $data = 'threecolumn2.php'; break; // Show Three columns with NO advertising blocks case "/index.html": case "/": case "/index.php": $data = 'threecolumn.php'; break; // TWO COLUMNS EVERY WHERE ELSE default: $data = 'twocolumn.php'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.