PDA

View Full Version : PHP code blocks


john_childs
2002-11-27, 09:24 AM
Code blocks formatted using the PHP tags don't make the transition to the newsgroup correctly. The PHP formatted block looses it's indentation and leading spaces when posted to the newsgroup.

It would be nice to have some way of posting formatted text (text with leading spaces, tabs, etc.) and have it make it to the newsgroup with the leading spaces.

I didn't try the CODE tag. Don't know if that would have worked better.

Gilby
2002-12-03, 05:38 AM
Fixed!

The PHP and CODE tags act the same way as they are processed the same (except how it is labeled). The problem was that I had a regular expression that had " *" in it and that was used to replace it with some text.

I changed this:
$section = ereg_replace("\n *","\n$pad",$pad.$section);

to this:

$section = ereg_replace("\n","\n$pad",$pad.$section);

john_childs
2002-12-04, 06:29 AM
Gotta love regular expressions. Every time I use them I have to go back to the help file and learn how to use them all over again.