Hi Guys, Can anyone help me out by telling me how I can display something for index.php and display something else for all different pages? I know how to do the normal if else statements, but I don't understand it when variables are put it, especially when you have to request the url. I will appreciate any help I can get. Regards, Nick
create an index.php file with different content than the other files holy shit I should become a rocket scientist
I guess that's why we have so many problems going into space; cause they hire people like you. I just put index.html as one of the files. I am gonna do this for about 15 other pages, so I didn't think anyone would answer this if they had to type so many lines. Now, if you have something more constructive, I would appreciate it. Otherwise, let the non-rocket scientists answer this. OK? Regards, Nick
Nick Non rocket scientist here offering something like this: $loc = $_SERVER['PHP_SELF']; # Then do something like: if($loc != 'index.php'){ include('files/other.file.html'); } else { include('files/index.html'); } PHP: If you wanted to take it a step further then you could build an array of your pages and if it doesn't include one of those pages - simply give them the index.html page.
IGiveMoney: Thank you very much. I haven't used it yet, but It looks like what I need. How would i go about building the array? Regards, Nick
This is what I usually use sometimes: <?php $allowedPages = array('test','game','weather'); //$_GET['page'] contains page name like TEST, Test or test $page = strtolower($_GET['page']); if(in_array($page,$allowedPages)){ include($page.'.php'); } else { include('main.php'); } ?> PHP: Peace,