|
-
Jun 22nd, 2006, 02:21 AM
#1
Thread Starter
Member
displaying messages...
Just as the function nl2br() , is there any function to handle the conversion of tab to html counterpart? (Or performs both).
-
Jun 22nd, 2006, 06:57 AM
#2
<?="Moderator"?>
Re: displaying messages...
check out htmlentities() but i think you would have to manually convert tabs to four 's.
-
Jun 22nd, 2006, 08:01 AM
#3
Re: displaying messages...
Tabs don't exist in HTML. If you need to indent just one line, use four s. If it's an entire paragraph, you might want to surround it in <blockquote>
-
Jun 22nd, 2006, 10:05 AM
#4
Re: displaying messages...
UAs ignore whitespace by default, unless you explicity say otherwise (using the CSS white-space property, or the <pre> tag which does that by default). Using non breaking spaces ( ) is not a good idea unless they really shouldn't be non-breaking spaces, i.e. a section of text should be displayed on one line.
If you need to indent text, use the text-indent property (for the first line of a paragraph) or the margin property (for the whole paragraph). You're using <p> tags? Good.
-
Jun 23rd, 2006, 05:57 AM
#5
Thread Starter
Member
Re: displaying messages...
Whts the exact procedure for displaying messages stored in a database?. Curently I am able to do this, But I need to display thr message exactly as enterd by the user keeping newline and spaces in place. With nl2br I have managed to handle newlines but the tab and white spaces are still a problem!!!.
Any shortcuts, other than checking for whitespaces manually?
-
Jun 23rd, 2006, 06:59 AM
#6
Re: displaying messages...
Use white-space:pre like I suggested.
HTML Code:
<p class="message">
<?=$message?>
</p>
Code:
.message {
white-space: pre;
}
-
Jun 25th, 2006, 11:54 PM
#7
Thread Starter
Member
Re: displaying messages...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|