b0lero Posted January 27, 2016 Share Posted January 27, 2016 Hey guys I'am new to this and i have idea how to do my counter strike web site got some design at the moment and im gonna try to explain to you what i want to do so . i use <?php $homepage = file_get_contents('stats.php'); echo $homepage; ?> to include another web pages only into black space . At the moment when u are in HOME PAGE in the black space its shown stats.php ... but how to make it when i click to NEWS to show me news.php whithout changing the page ? Sorry for my stupid explanation Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/ Share on other sites More sharing options...
b0lero Posted January 27, 2016 Author Share Posted January 27, 2016 what about ... <a href="stats.php" <?php if ($currentPage=="Home") echo "class=\"on\""; ?> Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530491 Share on other sites More sharing options...
ginerjm Posted January 27, 2016 Share Posted January 27, 2016 If you are doing a click on an anchor it is going to take you off that page. If you want to make an update to the current page WITHOUT leaving it, look into ajax and JS. Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530492 Share on other sites More sharing options...
b0lero Posted January 27, 2016 Author Share Posted January 27, 2016 All i want its to be simply cos the web site its local , so nobody will try do broke the security. All i want its to move from page to page from my navigation and to show the contant into a frame may be with AJAX and JavaScript will be too much. Thank You Very Much Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530493 Share on other sites More sharing options...
b0lero Posted January 27, 2016 Author Share Posted January 27, 2016 <a href="chapter1.htm" target="content">Index</a> on my index.php and then <base target="content"> on the other page. but that is with frames. Make sense to do it only with one frame and then just target them ? Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530497 Share on other sites More sharing options...
Solution ginerjm Posted January 27, 2016 Solution Share Posted January 27, 2016 You've lost me. I have no idea what you want. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530498 Share on other sites More sharing options...
b0lero Posted January 28, 2016 Author Share Posted January 28, 2016 Job Done thanks <a href='index.php?page=stats'><span>Home</span></a> <? if ($_GET['page'] == "stats") { include("stats.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530503 Share on other sites More sharing options...
QuickOldCar Posted January 28, 2016 Share Posted January 28, 2016 Is a few things should consider doing so has no errors. first check if $_GET['page'] is actually set with isset() next would be to check if that php file exists you are including with is_file() or file_exists() if(isset($_GET['page'])){ $page = trim($_GET['page']); if(is_file($page.".php")){ include($page.".php"); } } You can further make an array of only the pages want to allow $allowed = array("home","about","contact","stats"); if(isset($_GET['page'])){ $page = trim($_GET['page']); if(in_array($page,$allowed)){ if(is_file($page.".php")){ include($page.".php"); } } } Can add any else statements you desire, such as always include home.php as the default page if page is not set in the url Quote Link to comment https://forums.phpfreaks.com/topic/300676-help-with-navigation-site/#findComment-1530533 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.