$tag_name = "input";
$new_class = "yourclass";
eregi_replace("(<$tag_name)", "\\1 class=\"$yourclass\"", $yourstring);

will work for simple cases, but isn't going to give you much more power than
just applying a style to the tag iself  - 'input  { border : 1px }' say). If
the design is consistent, you can usually find longer blocks of unique text
for replacing headers, subheads, etc.

I'd run the scripts over your templates (backup first), not do output
buffering - manually tweaking a couple of exceptions is a hell of a lot
faster than building re's to catch them.

Matt

"Psychosphere2k" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi!

I have a fairly large PHP based website.
Unfortuantely, I didn't make extensive use of stylesheets.

I'm hoping for some help with regular expressions matching ( and =
replacing ) some tags.
I use output buffering, so it would be a simple case of adding some =
lines to my
output hanlder.

eg:
replacing  < input .... > with < input ....  class =3D "something " >
and < body .... > with < body .... class =3D "something_else" >

Some code, with comments would be really great.

Thanks in advance.

Peter Gibson






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to