![]() |
|
#1
|
|||
|
|||
Preformatting tag issuesok, I have a pm system on my site which I have been working on a little today. it all works fine, but when I try and format the read message page, it isnt working as Id like
when I read a message, it pulls the content from the sql table and displays it, as usual. now, when I dont add the <pre> tag it reads like Quote:
but when I use the <pre> tag it displays correctly Quote:
the only issue with using the <pre> tag is that it doesnt allow the wordwrap (that I know of). if a line is longer than the table layout, it will stretch the cell way out to the right and the page will get skewed. is there an alternative to the <pre> tag that will keep the formatting of the table when it calls it from the db, or a way to properly wrap text within a <pre> tag set? Thanks in advance for your help. |
|||
|
#2
|
||||
|
||||
Re: Preformatting tag issuesWe discussed something similar a few days ago: http://www.gidforums.com/t-20670.html.
When I use the <pre> tags to display code examples here, I use Cascading Stylesheets (CSS) width and overflow properties to control that a really long line of text does not stretch the overall layout of the page. Here is an example: CSS Code:
HTML Code:
It is important that you set the (CSS) height property value inline (with a style attribute) because if you have multiple "chat" transcripts to display, with variable lengths, you can simply count the number of newlines (and carriage returns) for each and set the height accordingly. Beyond a certain number of newlines, you simply set a fixed height, say 460px, so the reader finds it easier to scroll. |
|
#3
|
|||
|
|||
Re: Preformatting tag issuesOk, thanks. Ill try that. I did a ton of reading around today and it seems to be more of a major issue with IE6 & 7, regarding <pre> in a table cell and maintaining wordwrap. I found a site that gives a good CSS snip for pre, but it still doesnt affect IE6 or 7. If you know a sure fire solution to having wordwrap apply to pre in a table cell, Im all ears...definitely. I couldnt find anything anywhere that helped.
|
|
#4
|
||||
|
||||
Re: Preformatting tag issuesWhen you say "wordwrap", I assume you want to split a line (or a really long word) with server-side functions such as the one supplied by PHP?
You could do that but then you will be adding to your problems because NEW newlines could be inserted in your final text by the function. You could remove all newlines before processing the text through PHP's wordwrap() function but then that would also add new problems for you to solve. The simplest solution is what I mentioned above i.e. controlling the overflowing content through CSS. When I worked on the code example displays for this forum for the first time, it was way back in 2003, and at the time I am sure I was using Internet Explorer 6. I remember that the CSS overflow property didn't work with IE6 unless I set the width property too, which is why I mentioned it in my post. With Firefox, the width was not necessary and it will be relative to the previous tag's width. Your best bet would be to follow my suggestion above. If you find another equally simple solution, I hope you will share it with us. |
|
#5
|
||||
|
||||
Re: Preformatting tag issuesHow about a textarea? It wraps long lines automatically. If you add some style, you can make it look more like a pre.
HTML Code:
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Is this how our leaders fix nation's most important issues? | poppyyo8 | Open Discussion Forum | 1 | 24-Mar-2008 10:13 |
| Windows Updates and Secure Website Issues | LocalTech | Computer Software Forum - Windows | 0 | 31-Jul-2007 05:30 |
| Graphics Issues (Screenshots Included) | NovaTiger | Computer Hardware Forum | 2 | 03-Apr-2007 18:16 |
| Streamyx (DSL) and Windows ME issues. | JdS | Computer Software Forum - Windows | 4 | 03-Apr-2004 05:15 |
| Downloadable document compatibilty issues? | rhino1616 | Web Design Forum | 3 | 07-May-2003 04:05 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The