tbrama Posted May 17, 2009 Share Posted May 17, 2009 Here is what I need to do and wonder if someone could tell me how I could go about doing it. I have an HTML file that contains variables read by a flash template. The variable string starts and ends with an &. example: &home_text1=SOME TEXT HERE& What I would like to do is for the code to read through this file locate the first "&" and skip to the = sign then read and post the text in a text box for editing. People have suggested using a MySQL db but I am unaware of how to connect a db to this flash template. I have tried lots of different methods to read the file but don't know how I could filter through the file and do what I need it to. I have the base script to read and edit the file in one textarea but its to confusing to hand over to a customer. If someone could help me out here that would be great. Quote Link to comment https://forums.phpfreaks.com/topic/158462-reading-and-sorting-through-an-html-file/ Share on other sites More sharing options...
BobcatM Posted May 17, 2009 Share Posted May 17, 2009 Not sure I understand what you are asking. But why not use PHP and write to a text file and use Flash to read the txt file. That's what I do, but you may need something else. Quote Link to comment https://forums.phpfreaks.com/topic/158462-reading-and-sorting-through-an-html-file/#findComment-835706 Share on other sites More sharing options...
BobcatM Posted May 17, 2009 Share Posted May 17, 2009 Here is an example of the one I use for flash sites, so customers can update the regular stuff as needed like news. A little form - <form action="news.php" method="POST"> <input type="hidden" name="action" value="login"> <p align="center">UPDATE NEWS:<br /> <textarea rows="30" name="textbox" cols="80"> <?php include("news.txt") ?> </textarea><br /> <input type="submit" value=" Save Changes " class="button"> </p></form> And how I process it - <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> <script language="php"> $textbox = stripslashes($textbox); $search = array ('@[\r]+@'); $replace = array (''); $textbox = preg_replace($search, $replace, $textbox); $txt = ''; $output = $textbox; $fp = fopen('news.txt','w'); $txt = "$output"; fputs($fp, $txt); fclose($fp); </script> <style type="text/css"> <!-- .style1 { font-size: 24px; color: #000066; } .style2 {font-size: 24px; color: #000066; font-weight: bold; } --> </style> </head> <body bgcolor="#FFFFFF"> <p align="center" class="style1"> </p> <p align="center" class="style2">UPDATES COMPLETE, THANK YOU.</p> <p align="center" class="style2"><input name="Submit" type="submit" ONCLICK="window.location.href='updates.php'" value=" Back To Updates Page " /> </p> </body> </html> Hope that helps, if you need anymore info let me know. Heading to bed, can't see straight. Quote Link to comment https://forums.phpfreaks.com/topic/158462-reading-and-sorting-through-an-html-file/#findComment-835713 Share on other sites More sharing options...
tbrama Posted May 17, 2009 Author Share Posted May 17, 2009 You have something very similar to what I need and I plan to use php to write to the file but the thing is this file has all the text for each of the pages on the flash template. I need a way to break up the file. If there is a way for php to look for comments and break up each of the sections of the file into different text areas that would work as well. Quote Link to comment https://forums.phpfreaks.com/topic/158462-reading-and-sorting-through-an-html-file/#findComment-835828 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.