Hi all
I have an administration area to my site where users can input new values for a product.
The problem is that the text entered appears unformatted on my web pages.
What I would like to do is produce the facility to enclose text in paragraphs, make some bold and add links to this text.
Is there an easy way to do such a things?
thanks in advance
formatting text in back office
Moderator: General Moderators
Use nl2br to turn carriage returns (newlines) into <br /> tags. As regards making text bold, use a form of BBCode, such as the following:
Code: Select all
$bbcode = array('[b](.*?)[/b]' => '<b>\\1</b>'); //List of regex patterns & replacements
foreach ($bbcode as $pat => $rep) {
$yourtext = preg_replace($pat, $rep, $yourtext);
}