|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Article Discussion: Working With Text Files in PHP
Working With Text Files in PHP If you have any questions or comments about this article then please post them here.
You can read the article here . |
|
#2
|
|||
|
|||
|
ho3w can i make an email template. Example: when someone submits a comment, i want the mail form to pull in a HTHL document that gets used as the email template which will be sent to the user.
__________________
regards, Fulton |
|
#3
|
|||
|
|||
|
Do you want to store the template in an external file, or do you want to store the html code within your script?
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#4
|
|||
|
|||
|
Hi,
I would like to store the template in HTML format as an external file. |
|
#5
|
|||
|
|||
|
i have got it so the html file gets pulled into my email script, but when you recieve the email, you receive HTML and not frmatted HTML
|
|
#6
|
|||
|
|||
|
I would like to point out some mistakes on this article. A friend of mine tried using the examples and ended up with something that didn't work
![]() Basically this code is just wrong: PHP Code:
Firstly filesize($fp), In the php documentation URL states that filesize accepts one parameter which is a string, not a file pointer. This was causing problems for my friend. The correct line should be: $data = fread($fp, filesize("person.data")); Secondly why are we even doing the above line if we have that while loop? Both aren't needed!... The finished code should look like this: PHP Code:
or PHP Code:
Both do the same thing. Now there is more than 1 way to do anything in a programming language, and I would like to comment a "better" way of doing the explode("\r\n", $data); would of to use the file URL function which opens a file and returns a array of lines. The entire code would be: PHP Code:
Maybe also some error checking should go in there... But anyway thats my comments on the article, I never actually read past the first page, and I hope the author will be able to make corrections/improvements to his code. bramp |
|
#7
|
|||
|
|||
|
For some reason, I can read files fine, but when I try and open a file for writing, it gives this "Warning: fopen("newfile.txt", "w") - Permission denied" error. And I have tried putting a file named "newfile.txt" in that directory and it still didn't work, but even if it wasn't there it should create it..I don't understand why it's not working..
|
|
#8
|
|||
|
|||
|
nothing been written.
Hi,
Good article - I've got the code working fine - but nothing is inputted into the .data/.txt file - it will implement any text it Email: NAme: but the passed variable from the form won't input? any answers.? R |
|
#9
|
|||
|
|||
|
i am developing a web mail client with PHP.i have used text files to create address book.
i have some serious problems: can i update the information in the text file how can i delete a row please give me the function or method used to delete/update textfiles.it is very urgent cheers kiruba |
|
#10
|
|||
|
|||
|
Line #
How would I retrieve the line number on which certian data is located?
The reason I ask is I am developing a "database" application to store/retrieve college scholarship information where, unfortunately, MySQL is not an option for storing the data. My original approach to this delima was to use xml to store the entries, as this would allow for ease of presentation later on, but I have not found an easy way of deleting individual data entries from the xml file when needed. Thus, I have enlisted the use of flat files as the method of storing the scholarship information. However, being the newcomer that I am, I am unaware of any method of retrieving the line number of given data. If anyone can help me with this, or my xml problem, I would greatly appreciate an immediate response by email or reply to this post. Thanks! Last edited by Ty* : March 18th, 2003 at 12:47 AM. |
|
#11
|
|||
|
|||
|
Forbidden
hi guys !
here is my problem when i try to creat file with fopen() this error will come : <Error Starts> Forbidden You don't have permission to access /test/create_file.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. -------------------------------------------------------------------------------- Apache/1.3.28 Server at directory.myrajasthan.com Port 80 <Error End> and here is my code : <Code Starts> <?php $fp = fopen("newfile.txt", "w") or die("Couldn't create new file"); $numBytes = fwrite($fp, "\r\nLook, it's a very first line!"); fclose($fp); echo "Wrote $numBytes bytes to the end of newfile.file!"; ?> <Code End> can u please tell me why this happend ? Many Thanks !!! sun |
|
#12
|
|||
|
|||
|
Nice script.. but.. If I would like to add colors to the script.. like
Sex: <input type="radio" name="sex" value="M"> If I want that to be color green, how do I make that? / 1:an |
|
#13
|
|||
|
|||
|
Read particular line from txt file
This problem is killing me, and my knowledge of PHP….
I have a text file labeled “shows.radio” the contents are as follows: 2-4pm Show name 1 4-6pm Show name 2 6-8pm Show name 3 8-10pm Show name 4 10-12pm Show name 5 I would like to display one line from that text file when referenced by the time, so basically if the variable $time = 4-6pm is parsed to a script, the script will open the txt file and will display only the show tile “Show name 2” in the browser. How can this be done? |
|
#14
|
|||
|
|||
|
Hi..sorry to butt in..but I have a similar problem.
Here is my code. This works in that I get an email containing the contents of the text file 'sub_email1.txt' , but for some reason I can not APPEND to the EMAIL message variable. This is for a newsletter subscription and I need to append a REMOVE ME link. Remember, I get the email with the file contents but not with the appended information.
Please help as I am going crazy. (the red code doesn't seem to work) __________________________________________________ _____________________________________ $filename = 'sub_email1.txt'; $fp = fopen($filename, "a+") or die("Cant Open file"); $chunk = fread($fp, filesize($filename)); fclose($fp); $message = $chunk; $message .= '<a href="friend_in.php?rid='.$_POST['rid'].'" target="_blank">Click Here To Signup.</a><br>'; $message .= '<br><a href="remove_me.php?rid='.$_POST['rid'].'&sm_id='.$in_id.'" target="_blank">Click Here To Unsuscribe</a><br>'; $emaili = "staff@mycompanyemail.com"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: $from <$emaili>\n"; mail($_POST[email], 'Newsletter Subscription Information', $message, $headers); __________________________________________________ _________________________________ |
![]() |
| Viewing: Dev Articles Community Forums > Community > Development Tutorials > Article Discussion: Working With Text Files in PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|