Cooleyvol Posted December 29, 2007 Share Posted December 29, 2007 Ok, so I have a site with a page that I want to show multiple .txt files inside it based on the button clicked at the top of the page. I know how to include a txt file in that page, but I don't know how to make the txt file shown on the page chosen by the user selecting the web nav button of his choice. I know I could create multiple pages with the nav area at the top and each txt file on a separate page, but I'd like to create just one page and have only the middle content (text file) change based on the button selected. The nav area is at the upper portion; the txt file would display in a table below the nav area. Is there a way to do this? Here's a link to the page: http://iff.totalsportsworld.net/apexnav.php The buttons in the blue/yellow area would control which text file shows up in the area just below it (white b/g). Mark Cooley cooleyatcharterdotnet Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/ Share on other sites More sharing options...
teng84 Posted December 29, 2007 Share Posted December 29, 2007 <a href="http://www.w3schools.com/php/php_ajax_responsexml.asp">AJAX</a> Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/#findComment-425556 Share on other sites More sharing options...
Cooleyvol Posted December 30, 2007 Author Share Posted December 30, 2007 That example is involving a db. That's not necessary with just simple text files being called, is it? Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/#findComment-425561 Share on other sites More sharing options...
teng84 Posted December 30, 2007 Share Posted December 30, 2007 that is simple just replace the code that uses db with your text file.. it get info from the db then you should be fine getting info from your txt files actaully there is no diff.. Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/#findComment-425565 Share on other sites More sharing options...
trq Posted December 30, 2007 Share Posted December 30, 2007 I see no reason why ajax would be a suggested solution. All you simply need do is make you nav links pass a variable via get, then use this to display the correct file. eg; <ul> <li><a href="?f=foo">foo</a></li> <li><a href="?f=bar">bar</a></li> <li><a href="?f=bob">bob</a></li> </ul> <?php if (isset($_GET['f'])) { if (file_exists($_GET['f'] . '.txt')) { echo file_get_contents($_GET['f'] . '.txt'); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/#findComment-425575 Share on other sites More sharing options...
Cooleyvol Posted December 30, 2007 Author Share Posted December 30, 2007 I see no reason why ajax would be a suggested solution. All you simply need do is make you nav links pass a variable via get, then use this to display the correct file. eg; <ul> <li><a href="?f=foo">foo</a></li> <li><a href="?f=bar">bar</a></li> <li><a href="?f=bob">bob</a></li> </ul> <?php if (isset($_GET['f'])) { if (file_exists($_GET['f'] . '.txt')) { echo file_get_contents($_GET['f'] . '.txt'); } } ?> How would that be worked given the image in the supplied link to the page? That image will be hotspotted and those will be linked areas to the different txt files. Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/#findComment-425587 Share on other sites More sharing options...
Cooleyvol Posted December 30, 2007 Author Share Posted December 30, 2007 I see no reason why ajax would be a suggested solution. All you simply need do is make you nav links pass a variable via get, then use this to display the correct file. eg; <ul> <li><a href="?f=foo">foo</a></li> <li><a href="?f=bar">bar</a></li> <li><a href="?f=bob">bob</a></li> </ul> <?php if (isset($_GET['f'])) { if (file_exists($_GET['f'] . '.txt')) { echo file_get_contents($_GET['f'] . '.txt'); } } ?> Could I link the hotspots using just this code: <a href="?f=foo"></a> Quote Link to comment https://forums.phpfreaks.com/topic/83657-way-to-show-multiple-txt-files/#findComment-425665 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.