Hi all, I have on my site a part where users' can submit articles and no doubt their articles will contain code. Code is wrapped inside of [code] tags, i.e. [code]<?php echo "hi"; ?>[/code]
However, there is other text in the same article, so I need to format the code inside of the [code] and [/code] tags using htmlspecialchars, nl2br and highlight_file and the rest of the code needs to be formatted with nl2br, strip_tags and possibly stripslashes/wordwrap. A typical example: --- Count number of rows inside of MySQL table [code] <?php mysql_connect(host,user,pass); mysql_connect(db); $query = "SELECT * FROM table"; $result = mysql_query($query); $rows = mysql_num_rows($result); echo $rows; ?> [/code] Save the above code into a file called count.php --- The code inside of the [code] and [/code] tags needs htmlspecialchars, nl2br, highlight_file and the outside text needs nl2br, strip_tags, stripslashes/wordwrap. Sorry for being repetitive, but just need to make sure I make sense! Any ideas appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php