Hi all. I did search for this before I made a thread, problem is I don't really know what to search for My problem is: I have a lot of <? include("xxxxx.php"); ?> on my index page. Is it possible to exclude some includes on certain pages. For example say you go to www.mywebsite.com/index.php?site=forum and don't want <? include("xxxxx.php"); ?> to show on that page. http://www.ninthgaming.com/ this is the site im working on and at the moment. I will be very greatful for any help on this.
Of course you can. For example: switch( $_GET['site'] ) { default: include( "xxxxx.php" ); // any case excluding forum break; case 'forum': break; } Code (markup): You can add more cases if u want. I hope this helps u.
I'm still new, but I'll give it my best shot. if($_GET['site']!="forum") include('suchnsuch.file'); Code (markup):
First of all make an array of pages where you don't want to include file "xxxxx.php" $excludePages = array(); $excludePages[] = "forums.php"; $excludePages[] = "contact.php"; PHP: Then add following code where you are including "xxxxx.php" $currentPage = str_replace("/", "", $_SERVER['PHP_SELF']; if(!in_array($currentPage, $excludePages)) include("xxxxxx.php"); PHP: Hope this will help.