[thelist] PHP/MySQL forum with CSS

David Altherr einstein314 at hotmail.com
Wed Aug 22 00:39:24 CDT 2001


If you do go the route of stripping all the 'font' tags from a file, the
TextPad editor supports replacement via regular expressions across multiple
files.

I also wrote a a little more versatile PHP script that is useful for regexp
replacements on large directories of  files (will recursively run through
subdirectories, editing files).  The script uses the following (case
insensitive) regexp syntax:

$file_contents = preg_replace("/(<font [^>]*>)/i","",$file_contents);
$file_contents = preg_replace("/(<[\/]font[^>]*>)/i","",$file_contents);


You can grab the full script at

http://www.davidaltherr.net/misc/html_replacer.txt

just copy to your local file system, rename with .php extension, access it
via your browser through apache, and then specify, on the html form, the
starting directory and the file extension to edit; the script will edit all
files of the specified extension in the starting directory and all of its
subdirectories per the regular expression. (note: i've only tested it on a
Win2k box, you might want to test on a copy of the dir first)

To solve the problem of hacking your own CSS into their html you could just
modify the script like so:

$your_CSS = "
    <style type='text/css'>
    <!--
        TD {blah: 2;}
    -->
    </style>";

$file_contents =
preg_replace("/(<style.*<\/style>)/i",$your_CSS,$file_contents);

or you could get even more specific, per class if you wanted to:

$your_CSS_class = "TD{blah: 2;}";
$file_contents =
preg_replace("/(TD\{[^\}]*})/i",$your_CSS_class,$file_contents);

good luck

-David Altherr




> I have to install a php/mysql forum (i.e., message board) for a site I'm
> developing - so far I've tried phpbb, phorum, and w-agora - all of them
> work fine, but each one contains upwards of 1000 font-related tags, and
> piles of bgcolor type stuff. I haven't published a site with a font tag in
> nearly 3 years, and I don't want to do it now. The usage is such that it
> isn't easy to just strip this stuff out using search and replace -
> basically I'm looking at a couple of days worth of very tedious work to
get
> rid of them, and they are somewhat incorporated in the functionality
(i.e.,
> it's not just a matter of deleting html tags).
>
> So has anyone ever encountered a php/mysql forum that uses CSS for
> appearance (tables are fine for layout)? Or at least could be easily
hacked
> to use CSS?
>
> Thanks very much,
> Noah





More information about the thelist mailing list