[FX.php List] Separating out paragraphs in text variable

Derrick Fogle derrick at fogles.net
Mon Dec 11 18:39:20 MST 2006


Exactly where are you coming from, and going to? Is this being  
entered into FMP, and displayed on a web page via PHP, or the other  
way around? Or maybe being put into a textarea on the web, stuffed  
into FMP, then displayed back out into a textarea?

When getting text out of FMP into PHP via FX.php, I see the Pilcrow  
(return character in FMP text field) come across as a \n only. When I  
put text into FMP from PHP via FX.php, I have to submit \r only. This  
seems bizzare, but then again I'm using Mac OSX for everything.



On Dec 11, 2006, at 7:13 PM, Bob Patin wrote:

> Kevin,
>
> Thanks for the reply; all I really need is to get my paragraphs  
> separated... but for whatever reason, I use this:
>
> $body = nl2br($body);
>
> and I still get the same bad results that I showed below...
>
> Sigh...
>
> Bob
>
>
> On Dec 11, 2006, at 7:03 PM, Kevin Futter wrote:
>
>> On 12/12/06 11:45 AM, "Bob Patin" <bob at patin.com> wrote:
>>
>>> I thought I'd already solved this, but apparently not...
>>>
>>> I have a site where I can type an entry into a form, and then it's
>>> displayed on the site...
>>>
>>> If I enter
>>>
>>> Line 1
>>>
>>> Line 2
>>>
>>> Line 3
>>>
>>> I get:
>>>
>>> Line 1Line 2Line 3
>>>
>>> Someone please refresh my memory: what's the command to take the
>>> variable (call it $text) and have it display properly?
>>>
>>> Thanks,
>>>
>>> Bob Patin
>>
>> nl2br() will work if you're not fussy about semantic markup, but  
>> since I am,
>> I wrote a function that churns out legitimate HTML paragraphs,  
>> rather than
>> torrents of break tags.
>>
>> function formatDesc($input)
>> {
>> $br = chr(10); // single line feed character (LF)
>> $p = "<br />\n<br />\n";
>> $badChars = array($p, "& ");
>> $goodChars = array("</p>\n\t\t<p>", "&amp; ");
>> $text = str_replace($br, "<br />\n", $input); // replace LF with  
>> <br />
>>
>> $description = str_replace($badChars, $goodChars, $text);
>> echo "<p>" . $description . "</p>\n";
>> }
>>
>>
>>
>> -- 
>> Kevin Futter
>> Webmaster, St. Bernard's College
>> http://www.sbc.melb.catholic.edu.au/
>>
>>
>>
>> ------------------------------------------
>> This e-mail and any attachments may be confidential.  You must not  
>> disclose or use the information in this e-mail if you are not the  
>> intended recipient.  If you have received this e-mail in error,  
>> please notify us immediately and delete the e-mail and all  
>> copies.  The College does not guarantee that this e-mail is virus  
>> or error free.  The attached files are provided and may only be  
>> used on the basis that the user assumes all responsibility for any  
>> loss, damage or consequence resulting directly or indirectly from  
>> the use of the attached files, whether caused by the negligence of  
>> the sender or not.  The content and opinions in this e-mail are  
>> not necessarily those of the College.
>>
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


Derrick Fogle
derrick at fogles.net





More information about the FX.php_List mailing list