pintee Posted May 1, 2013 Share Posted May 1, 2013 Hi everyone,I would like to have my website display different content while remaining on the same index.php page. The functionality I am after is demonstrated bywww.sryth.com. If you sign up for an account, login, and start a new game, you will see what I mean. The address stays the same throughout the game(i.e.www.sryth.com/game/index.php), even as new content is being displayed. How do I achieve this effect??I have been searching all morning for the solution to this problem but have come up with nothing. Answers given in forums have all lead to dead ends, so I'm hoping someone can come up with a definitive solution. Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/ Share on other sites More sharing options...
oaass Posted May 1, 2013 Share Posted May 1, 2013 They use iframe Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427429 Share on other sites More sharing options...
Irate Posted May 1, 2013 Share Posted May 1, 2013 Either use a frame/iframe tag or do URLRewrite. An example for an iframe and a frame tag (my school uses the frame tag on their home page, by the way): <!DOCTYPE html> <head> <title> Site Title </title> </head> <body> <iframe src="index.php" name="Index"></iframe> <!-- or use this <frame name="Main Site" src="index.php?rewrite=main%20site"></frameset> --> </body> </html> You can in fact do this with embed and object tags, too. I wouldn't use the URLRewrite option unless you are not familiar with HTML (which is unlikely because HTML is much easier than URL Rewriting), though. Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427456 Share on other sites More sharing options...
trq Posted May 1, 2013 Share Posted May 1, 2013 url rewriting isn't going to be of any help, neither is php. Any solution to this issue is going to need to be done client side. Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427457 Share on other sites More sharing options...
pintee Posted May 1, 2013 Author Share Posted May 1, 2013 url rewriting isn't going to be of any help, neither is php. Any solution to this issue is going to need to be done client side. Do you mean AJAX? Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427459 Share on other sites More sharing options...
DaveyK Posted May 1, 2013 Share Posted May 1, 2013 Backbone.js can do this. It basically keeps the user from loading new pages but rather refreshes parts of the page using AJAX. But even with normal JS you can go a long way. Dont use iframes. Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427460 Share on other sites More sharing options...
trq Posted May 1, 2013 Share Posted May 1, 2013 Do you mean AJAX? That is one way of doing it yeah. Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427463 Share on other sites More sharing options...
pintee Posted May 1, 2013 Author Share Posted May 1, 2013 I've been experimenting with this www.sryth.com site in order to glean how it might be implemented. * Firstly I login and start off from www.sryth.com/game/index.php. (this has content on it like text and links) * Secondly, I open a link on the page in a new window. This brings up the address http://www.sryth.com/game/ci.php?f_c=set_pc_location2.inc&f_zoneid=4&f_sectionid=10561&f_previouszoneid=4&f_previoussectionid=1 for a split second before redirecting to the address http://www.sryth.com/game/ci.php?f_c=parser2.inc (this page also has content on it like text and links). Any guesses as to the implementation from what I have just described? Forgive my curiosity....... Quote Link to comment https://forums.phpfreaks.com/topic/277479-how-to-have-indexphp-load-different-content/#findComment-1427468 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.