ColdH4x Posted February 26, 2007 Share Posted February 26, 2007 How can I "des-include" everything that I have included using include() ? Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/ Share on other sites More sharing options...
ShogunWarrior Posted February 26, 2007 Share Posted February 26, 2007 Do you mean "un" include something. AFAIK that isn't possible because including by definition means you are inserting the code into the current script which obviously can't be reversed. Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/#findComment-194616 Share on other sites More sharing options...
nloding Posted February 26, 2007 Share Posted February 26, 2007 Why would you need to is my question. Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/#findComment-194617 Share on other sites More sharing options...
boo_lolly Posted February 26, 2007 Share Posted February 26, 2007 ok, two different accounts... seems like same poster... anyway, use an if statement. Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/#findComment-194624 Share on other sites More sharing options...
ColdH4x Posted February 26, 2007 Author Share Posted February 26, 2007 I'm creating the following code to use in a menu: <?php include("home.php"); if ($_GET['c']=="test") { include("test.php"); } ?> I want it to include "home.php" when the file is loaded... no problem in here. The problem is when "c==test". This will include "test.php" in the bottom of the page... leaving the "home.php" in the browser as well... when I only wanted to show the "test.php" Using header() solved my problem, but another appeared. If using header() to load the pages insted of showing in the URL ".php?c=teste" it shows "/test.php", and I want it to show the ".php?c=test" thing. Using fopen() doesn't works as well as it retrieves me a blank page... Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/#findComment-194686 Share on other sites More sharing options...
ShogunWarrior Posted February 26, 2007 Share Posted February 26, 2007 Just do the following and add any pages you want into case statements: switch( $_GET['c'] ) { case "test":{ include('test.php'); break; } case "home": default: { include('home.php'); } } Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/#findComment-194690 Share on other sites More sharing options...
ColdH4x Posted February 26, 2007 Author Share Posted February 26, 2007 Thanks that solved my problem! Quote Link to comment https://forums.phpfreaks.com/topic/40229-solved-how-to-des-include/#findComment-194709 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.