icefire Posted June 19, 2010 Share Posted June 19, 2010 i'm trying to do a learning website page that show a code and its execution in one page i used iframe technique for that. my problem is that i'm trying to let the user to modify the code and save it then show the execution to next frame "output frame". How can i make this Step ?? what should i do ? my webpages : index.php <?php include("includes/config.php"); $page_title='Learning PHP step by step...'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset= UTF8-Bin" /> <link href="css/style.css" type="text/css" rel="stylesheet"/> <title><?php echo APP_TITLE?> - <?php echo $page_title?></title> <frame name = "m2" src = "include/m2.php" /> </head> <body> <div id="container"> <div id="header"><?php include("includes/header.php"); ?></div> <div id="topBar"><?php include("includes/top-bar.php"); ?></div> <div id="topBar2"><?php include("includes/top-bar2.php"); ?></div> <div id="menu"><?php include("includes/menu.php"); ?></div> <div id="m2"><?php include("includes/m2.php"); ?></div> <div id="m3"><?php include("includes/m3.php"); ?></div> <br style="clear:both" /> <div id="footer"><?php include("includes/footer.php"); ?> </div> </div> </div> </body> </html> include/m2.php <html> <body> <font face="verdana,arial" size="3"> <div align="center"> <p> <iframe name="iframe1" width="320" height="320" src="" frameborder="yes" scrolling="yes"> </iframe> <p> </font> </div> include/m3.php <html> <body> <font face="verdana,arial" size="3"> <div align="center"> <iframe name="iframe2" width="320" height="320" src="" frameborder="yes" scrolling="yes"> </iframe> </font> </div> include/menu.php <div> <ul> <li><a href="lab00.txt" target="iframe1">Getting started </a><a href="lesson00.html" target="iframe2">(Lesson00)</a></li> </ul> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> include/top-bar2.php <div style="background-color:#fdfdfd;border-bottom:solid 1px #BBB; padding:.8px"> ..........................LESSONS ............................................................CODE..................................................................................OUTPUT....................................................<a href="#"></a> </div> Quote Link to comment Share on other sites More sharing options...
jd307 Posted June 19, 2010 Share Posted June 19, 2010 Using an iFrame for this, all you need is two pages (entercode.php and showcode.php, for example): entercode.php <form action="showcode.php" method="post" name="form" target="frame1"> <textarea name="msg" cols="50" rows="5"></textarea> <input type="submit" value="Display Message" /> </form> <iframe width="500" height="500" name="frame1"> </iframe> showcode.php <?php $test = $_POST['msg']; echo eval($test); ?> This will give you the most basic method of doing something like this. Quote Link to comment Share on other sites More sharing options...
icefire Posted June 19, 2010 Author Share Posted June 19, 2010 showcode.php not work it shows ths msg {Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\XXXX\showcode.php(3) : eval()'d code on line 1} Quote Link to comment Share on other sites More sharing options...
icefire Posted June 21, 2010 Author Share Posted June 21, 2010 anybody can help me i still get error msg "Parse error: syntax error, unexpected $end in C:\xampp\htdocs\XXXX\showcode.php(3) : eval()'d code on line 1" Quote Link to comment Share on other sites More sharing options...
icefire Posted June 21, 2010 Author Share Posted June 21, 2010 :'( Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 21, 2010 Share Posted June 21, 2010 Why are you using eval. This is a dangerous function to use. It seems your templates only contain HTML/CSS code in which case you do not need to use eval. Quote Link to comment Share on other sites More sharing options...
icefire Posted June 21, 2010 Author Share Posted June 21, 2010 thanX i solved Quote Link to comment 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.