RE: [PHP] Large text fields

From: Date: Mon, 06 Nov 2000 01:43:38 +0000
Subject: RE: [PHP] Large text fields
Groups: php.general 
Request: Send a blank email to php-general+get-23824@lists.php.net to get a copy of this message
If you think about it this way -> your text is in the database -> you will need to show it later on (a) on a 100% width page, (b) on a limited width page, (c) in some table's cell with limited, or even unknown width attributes, (d) in a form, textarea, (f) on some even unknown script following some unknown design which YOU will write once your site will get as big as AltaVista or something :-)) In any of these cases you will want to have a unformatted 'text' just like it sounds: 'text' so there are no tags, everything is escaped and linebreaks/paragraphs can be recognized only by repeating \n (or \r, \n\r ). Isn't it easier to parse the text when the page loads to aggiust it for the perfect HTML format so on 'view source' it looks like some human just typed it in and not a database? 2.) <PRE> are NOT SAME from <P>. it shows up on different browsers always differently, plus it is almost always few points smaller in size.. 3.) <PRE> does work well when showing up an address or code. but not an article, since articles are huge texts and so will always have to wrap, <PRE> is terrible for wrapping. These are my points. any questions please ask. Maxim Maletsky -----Original Message----- From: Russell Barr [mailto:rbarr@quik.com] Sent: Friday, November 03, 2000 2:26 AM To: Maxim Maletsky; Claus Nybo; csano@choiceoneonline.com Cc: php-general@lists.php.net Subject: Re: [PHP] Large text fields Maxim wrote: > No, <pre></pre> would output the whole paragraph in a single line each. Under what conditions? My only php project has been one very similar in concept to what Claus is doing ( www.knifepoints.com -> search ), so my experience is limited, but it does contradict your assertion. I cut and paste chunks of text into a <textarea>, insert them into a mysql db and then return them as search results. I put <pre> tags around the output, and it comes out the same way it went in. That's a pretty cool class you wrote and the possibility of using it sent me running to check my own code. The only unbroken lines in my search output are where the lines went in unbroken. I don't see where class max_Organizer would help me there. I can't see why I'd want to use a server side solution to replace formatting that is already there for the client to use. Please enlighten me. Russell > I use (for articles) a class, that uses RegEx changing every "\n" (more then > juts \n - newline) to "\n<BR>" and every "\n<BR> (spaces, tabs, > newlines) > \n<BR>" \n\n<P> > > in this way the output look real cool and the database can be reused just by > a simple substring() of <BR> and <P> 's. > I input it like this already in the database since RegEx are slow and > because I like to make HTTP request some faster. > > Here's the class I use: > > I think you can easily figure out how to use it: > If got any problems do not hesitate to ask me. (might not reply till next > Monday) > > Cheers! > class max_Organizer snipped> > Use <pre></pre> tags around the output > Russell > > > Hi, > > > > I am working on a website using php3 and mySQL. On one page in the site > > administration is inputting new articles, via a form, with fields such as > > $title, $date, $article, etc. These are then passed to mySQL, to be viewed > > on another page by users. > > > > This all works fine, except for the text of the article itself. When the > > text is typed in to the textfield on the form, it exist of several > > paragraphs, with blank lines in between, but when it is viewed from the > > database on another page all the paragraph breaks and blank lines are > gone, > > and all the text is displayed in just one long continued block. > > > > What do I do to preserve the format in which the text is typed? With the > > different paragraf breaks and blank lines? > > > > Thanks for the help! > > > > Claus > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#23824) next »