Dood77 Posted May 8, 2007 Share Posted May 8, 2007 I'm currently using an index.php that displays the title, menu etc. and grabs a string from the address (/index.php&content=*blah*) to get the content for the page externally using include. (I don't have the code with me at the moment, I forgot it at home) It works similarly to this: <body> <table> <tr><td> [menu] </td> <td> <?php $content = $_get["content"] . ".htm" include($content) ?> </td></tr> </table> The syntax is probably wrong there but thats not my issue. It works fine, but the menu I have is flash and whenever I click a link on it the whole page has to reload and the flash has to reload and it flashes (no pun intended) white. I realize this isn't really a php problem per se, but I figure you guys can help anyway, maybe theres a better way to dynamically load the content in the page without having to reload all the other stuff? Before I decided to go with php I was using javascript to dynamically change the src attribute to an iframe, but the iframe height can't very easily be calculated and changed dynamically... So, yeah, responses appreciated and all that Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/ Share on other sites More sharing options...
taith Posted May 8, 2007 Share Posted May 8, 2007 only 1 of loading pages, without changing pages... ajax... p.s. thats a VERY unsecure way of doing it Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/#findComment-248249 Share on other sites More sharing options...
Dood77 Posted May 8, 2007 Author Share Posted May 8, 2007 only 1 of loading pages, without changing pages... ajax... p.s. thats a VERY unsecure way of doing it Hm, I don't know why ajax didn't occur to me but I'll look into it... And by very insecure you mean...? Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/#findComment-248519 Share on other sites More sharing options...
marcus Posted May 8, 2007 Share Posted May 8, 2007 If you still want to do it like that, you can do: $content = $_GET['content']; //$content = mysql_real_escape_string($content); //only if you're pre-connecting to a database if($content){ $content_new = "$content.htm"; if(file_exists($content_new)){ include "$content_new"; }else { echo "This file does not exist"; } } Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/#findComment-248526 Share on other sites More sharing options...
Dood77 Posted May 9, 2007 Author Share Posted May 9, 2007 I'm not understanding what you're doing here... checking to see if the content loaded is already loaded? I already have an if statement that checks to see if the file is there, and redirects if its not. Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/#findComment-248664 Share on other sites More sharing options...
taith Posted May 9, 2007 Share Posted May 9, 2007 ohok... from the code you provided ontop, its tellling us that anybody could just type over that url, and get another page... not withstanding if its there or not. Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/#findComment-248859 Share on other sites More sharing options...
Dood77 Posted May 9, 2007 Author Share Posted May 9, 2007 Yeah, like I said, I didn't have the original code with me at the moment. But actually I do now: <head> <?php $content = $_GET["content"]; ?> </head> <body> <?php if (strlen($content) == 0){ header ("Location: index.php?content=intro"); } elseif (!file_exists($content . ".htm")){ $content = "error"; } include($content . ".htm"); ?> </body> Quote Link to comment https://forums.phpfreaks.com/topic/50526-dynamic-content-on-my-indexphp/#findComment-249139 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.