1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Burlington, VT
    Rep Power

    PHP->CSS converter?


    I know this may be a difficult request, and I don't have my hopes up too high... But, I am looking for a means of converting cascading style sheets to their html equivalent tags/properties using PHP, of course. A little background - I trying to build an html emailer that allows a user to type in a URL - most likely their own (that they just created using part of my content management softare). Now, I am doing this using the file() function and processing the output to the email's message. However, there are always setbacks with this. First was the absolute path issue (knew about this for a long time graphics/links, etc.), but now I have to deal with stylesheet limitations not rendering the proper page design? I have tried hotscripts.com for some scripts, but I also figured I try here for some real feedback.

    thanks for any help,
  2. #2
  3. No Profile Picture
    Always Learning
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2002
    Port Neches, TX, USA
    Rep Power
    You're going to have to get familiar with regular expressions, and parse the code. You need to look for tags that are <xxx style="property:x;"> . So, you want to parse for style=", read what's between "" into an array, cut off the ; ,explode it on :, and then parse the property to make sure it's valid. You also have to be careful to parse the value for % or px, or pt even. It's a pretty big job..
    David Fells
    If my post helped you, please click the above my post and leave a comment. Thanks

IMN logo majestic logo threadwatch logo seochat tools logo