473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help with includes / font tag

Hi,

I was wondering how I would be able to strip the <font> tags from a file
when I include it so it can take on the characteristics of my own stylesheet
instead of the font tag attributes.

Thanks in advance!
John

Jul 17 '05 #1
6 4367
On 2004-01-23, John <gt*****@mail.gatech.edu> wrote:
Hi,

I was wondering how I would be able to strip the <font> tags from a file
when I include it so it can take on the characteristics of my own stylesheet
instead of the font tag attributes.


So you want to _replace_ the string "<font>" by the string "" ?

http://www.php.net/manual/function.str-replace.php
--
http://home.mysth.be/~timvw
Jul 17 '05 #2
"John" <gt*****@mail.gatech.edu> wrote in message
news:bu**********@news-int2.gatech.edu...
Hi,

I was wondering how I would be able to strip the <font> tags from a file
when I include it so it can take on the characteristics of my own stylesheet instead of the font tag attributes.

Thanks in advance!
John


$text = preg_replace("'<font[^>]*?>(.*?)</font>'si","\\1",$text);

Although you may have to watch out for style="blah" and class="blah"
attributes in other html tags

HTH

Cheers,
thunder
Jul 17 '05 #3
On 2004-01-23, Tim Van Wassenhove <eu**@pi.be> wrote:
On 2004-01-23, John <gt*****@mail.gatech.edu> wrote:
Hi,

I was wondering how I would be able to strip the <font> tags from a file
when I include it so it can take on the characteristics of my own stylesheet
instead of the font tag attributes.


So you want to _replace_ the string "<font>" by the string "" ?

http://www.php.net/manual/function.str-replace.php


You could replace all occurences of <font (.*?)> with a regular
expression. And the </font> tags with str_replace.

If you try to match them with 1 regular expression, you run into problems when you
have nested tags, fe: <font><font></font></font>.

--
http://home.mysth.be/~timvw
Jul 17 '05 #4
John wrote:
I was wondering how I would be able to strip the <font> tags from a file
when I include it so it can take on the characteristics of my own stylesheet
instead of the font tag attributes.


You could use an HTML parser of sorts to remove tags. One regular
expression would probably be insufficient.

On the other hand, you could make a rule in your stylesheet to
override presentational effects that the font element would suggest.
Better to remove it though, in general.

--
Jock
Jul 17 '05 #5
"John Dunlop" <jo*********@johndunlop.info> wrote in message
On the other hand, you could make a rule in your stylesheet to
override presentational effects that the font element would suggest.
Better to remove it though, in general.


I wasn't aware that was possible... what's the command for that?

Thanks in advance!

Jul 17 '05 #6
John wrote:
"John Dunlop" <jo*********@johndunlop.info> wrote in message

On the other hand, you could make a rule in your stylesheet to
override presentational effects that the font element would suggest.
Better to remove it though, in general.


I wasn't aware that was possible... what's the command for that?


There is no command, only suggestions. (See CSS2, sec. 6.4.4.)

That doesn't remove font tags from your markup though.

--
Jock
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Kai Jaeger | last post by:
I am playing with setting font sizes in CSS using em as unit of measurement. All seems to be fine. Even Netscape Navigator shows the characters very similar to IE, what is not the kind if px is...
30
by: Mark Tranchant | last post by:
Take a look at this page: http://tranchant.plus.com/cycling/gears/ratio Just over half-way down is the sentence 'My wheels are approximately 27? in diameter'. I use the ″ double prime for...
1
by: shachar | last post by:
hi all. i have a grid ocx i'm using, and i have to set it's font to an integer value returning from a font object. when i wrote : Dim f As System.Drawing.Font al it's propertys are readonly. how...
11
by: Lord Alydar | last post by:
On the book I have it says the font in the sctipt mode should be color coded as in green for strings orange for special words and blue for statements. But my font is all in one color when I write....
5
by: Arch | last post by:
This question is so dumb that I'm embarrassed to ask it, but I've searched and googled and can't find the answer. I am making the switch from Access 2000 to Access 2003. In A2K3, the font is so...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.