Just as the function nl2br() , is there any function to handle the conversion of tab to html counterpart? (Or performs both).
:wave:
Printable View
Just as the function nl2br() , is there any function to handle the conversion of tab to html counterpart? (Or performs both).
:wave:
check out htmlentities() but i think you would have to manually convert tabs to four 's.
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>
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.
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?
Use white-space:pre like I suggested.
HTML Code:<p class="message">
<?=$message?>
</p>
Code:.message {
white-space: pre;
}
Thanks for the reply.