Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 31-12-2004, 04:30 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 116
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
How to remove Line Feeds (LF) of a page?

Hi,

I try to grab the content from a page with A LOT of line feeds("LF", a "\n" ?) but failed.

How do we strip out the line-feeds, carriage return, new line, etc. for a whole page? Do we use str_replace() ?

I found this:
PHP Code:
//convert news to HTML encoding for saving
$htmlnews htmlentities($_POST["news"]); //make remaining items html entries.
$htmlnews nl2br($htmlnews); //add html line returns
$htmlnews str_replace(chr(10), " "$htmlnews); //remove carriage returns
$htmlnews str_replace(chr(13), " "$htmlnews); //remove carriage returns 
link: http://forums.devarticles.com/printthread.php?t=1662

Anyone kind enough to provide the code?

By the way, the code will be used to generate RSS feed of http://www.petalingstreet.org

Thank you in advance.
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 31-12-2004, 05:06 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 116
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
ok. I have stripped out those LF.
Going to GRAB the contents...

I am using preg_match_all().
Any better suggestion?
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 31-12-2004, 08:35 PM
webber's Avatar
Inspired Webmaster
 
Join Date: Dec 2004
Location: Kuala Lumpur
Posts: 105
Rep Power: 49
webber is on a distinguished road
Hi,

Try this:
1. Parse the strings line by line.
2.a. For each line, use trim() to remove space, tab, line feed, carriage return, NUL-byte and vertical tab.
2.b. Append the 'trim'ed line to a buffer
3. Output the buffer

Hope this will help
The webber
__________________
Send Trackback and Submit your blog to Blog Portal
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anybody here participate in on line survey? pohkeiong Mamak Stall 1 15-01-2006 06:05 PM
nak remove password awida Mamak Stall 10 14-11-2005 02:42 PM
Thin Fine Line @ noorullah.org MENJ Websites Review and Suggestion 5 27-12-2004 02:03 PM
WALK-IN INTERVIEWS: DIGI IT Line Department Dateline 31 July Defcon Job Vacancies 2 02-08-2004 02:13 AM
How to remove this thing? eric Website Design 26 05-03-2004 10:34 AM



All times are GMT +8. The time now is 02:32 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59