| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() | Shortening (HTML/PHP) Hey all. I'm sure this is quite simple but basically I'm displaying a text file in a textarea but only want to display a certain number of lines. I'm using 'fread' but I think you can only set the number of bytes rather than number of lines. Anyway, there are three ways I'm looking at doing it: 1. With the fread function, somehow. 2. When the contents of the text file are stored as a variable. 3. ..or with the 'textarea' field itself. Just need a little bit of guidance. Thanks
__________________ Encenta - Amazon Associates CMS |
| |
| | #2 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Something like this: PHP Code: |
| |
| | THREAD STARTER #3 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() | Thanks for the help. Small donation sent
__________________ Encenta - Amazon Associates CMS |
| |
| | #4 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | Small update for SV's code. You can replace: PHP Code: PHP Code: |
| |
| | #5 (permalink) |
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,552
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | http://php.net/manual/en/function.fgets.php: Reading a file line by line PHP Code:
__________________ NameNewsletter.com - free lists of available domain names ZoneFiles.net (beta) - ccTLD and gTLD droplists |
| |