replacing a string with a changing expression WITH PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bnashenas1984
    Contributor
    • Sep 2007
    • 257

    replacing a string with a changing expression WITH PHP

    Hi everyone
    I havn't worked with regular expressions and (eregi_replace) so much and now I need to replace a string with another string which is not always the same.

    Here is the issue:
    I have a normal HTML code which is imported from a flash file. I need to change size in FONT tags with a style

    for example :
    Code:
    <font size="12">Here comes some text</font>
    should be changed to:
    Code:
    <font style="font-size:12px">Here comes some text</font>
    but the problem is that font size is not allways the same. It could be any other number instead of 12.


    Thnaks
    Last edited by bnashenas1984; Aug 11 '08, 05:18 PM. Reason: more information is needed
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I would past the text into a div that has an id (or class) and set the font size in the css
    Code:
    <!-- HTML -->
    <div id="flashtext">Here comes some text</div>
    
    /* CSS */
    #flashtext {
        font-size: 12px;
    }

    Comment

    Working...