[PHP] Text File Formating.
Hi there, I have got various text files which I need to convert on the fly to HTML with PHP. How do I convert this: --- TEXT --- CHART RETURN Chart Date: blah No. Artist - 'Track (Remix)' (Label) 1. blah - 'blah (blah mix)' (blah) --- END TEXT--- to this: --- HTML --- CHART RETURNbr / br / Chart Date: blahbr / br / No. Artist - 'Track (Remix)' (Label)br / br / 1. blah - 'blah (blah mix)' (blah)br / --- END TEXT--- Any help much appreciated, Ian. --- Randum Ian DJ / Reviewer / Webmaster, DancePortal (UK) Limited [EMAIL PROTECTED] http://www.danceportal.co.uk DancePortal.co.uk - Global dance music media -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Text File Formating.
the manual is your friend. http://www.php.net/manual/en/function.nl2br.php * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Randum Ian [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 10:20 AM To: PHP Subject: [PHP] Text File Formating. Hi there, I have got various text files which I need to convert on the fly to HTML with PHP. How do I convert this: --- TEXT --- CHART RETURN Chart Date: blah No. Artist - 'Track (Remix)' (Label) 1. blah - 'blah (blah mix)' (blah) --- END TEXT--- to this: --- HTML --- CHART RETURNbr / br / Chart Date: blahbr / br / No. Artist - 'Track (Remix)' (Label)br / br / 1. blah - 'blah (blah mix)' (blah)br / --- END TEXT--- Any help much appreciated, Ian. --- Randum Ian DJ / Reviewer / Webmaster, DancePortal (UK) Limited [EMAIL PROTECTED] http://www.danceportal.co.uk DancePortal.co.uk - Global dance music media -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text and formating
I have news webpage of sorts that pulls entries out of a mysql database. There is a form to submit news and it is automatically added to the new page upon submition. What I am wandering is when a individual submits news, the end result on my news page does not hold the same format it was put in. For example. IN the "add news form" they enter the info in like this: -- This is a test. How are you today. Laddi da, Laddi da -- The output on the news page comes as: This is a test. How are you today.Laddi da, Laddi da Is there a way between php and mysql to ensure that format of the date is same going in and out? Thank you in advance:) Sono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Text and formating
You need to do a str_replace() on any fields that need to have breaks in them. Try something like this: echo str_replace ("\n", "BR", $fieldvariable) Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here IN the "add news form" they enter the info in like this: -- This is a test. How are you today. Laddi da, Laddi da -- The output on the news page comes as: -- -- This is a test. How are you today.Laddi da, Laddi da -- -- Is there a way between php and mysql to ensure that format of the date is same going in and out?
RE: [PHP] Text and formating
or you could just call the nl2br() function to do the same thing... Jay Paulson Developer, Web Technologies Viatel, Inc. -Original Message- From: Hoover, Josh [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 11:22 AM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] Text and formating You need to do a str_replace() on any fields that need to have breaks in them. Try something like this: echo str_replace ("\n", "BR", $fieldvariable) Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here IN the "add news form" they enter the info in like this: -- This is a test. How are you today. Laddi da, Laddi da -- The output on the news page comes as: -- -- This is a test. How are you today.Laddi da, Laddi da -- -- Is there a way between php and mysql to ensure that format of the date is same going in and out? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Text and formating
nl2br -- Inserts HTML line breaks before all newlines in a string http://php.net/manual/en/function.nl2br.php -Brian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 12:09 PM To: [EMAIL PROTECTED] Subject: [PHP] Text and formating I have news webpage of sorts that pulls entries out of a mysql database. There is a form to submit news and it is automatically added to the new page upon submition. What I am wandering is when a individual submits news, the end result on my news page does not hold the same format it was put in. For example. IN the "add news form" they enter the info in like this: -- This is a test. How are you today. Laddi da, Laddi da -- The output on the news page comes as: This is a test. How are you today.Laddi da, Laddi da Is there a way between php and mysql to ensure that format of the date is same going in and out? Thank you in advance:) Sono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]