I am going to be writing a PHP mailing list system. Ideally, I would like for the templates styles to be easy to manage. In my current system, I have the styles all hardcoded in the template like this:
<a href="http://blah/blah/blah" style="color: #a8a8a8;">click here</a>
This works alright until the person managing the template decides that they want to change the color of the link text. What I'd really like is to have something process the HTML and style definitions and output the HTML with the appropriate HTML.
What I am hoping for is something that will take the following input:
<style type="text/css">
a {
color: #a8a8a8;
}
</style>
<a href="http://blah/blah/blah">click here</a>
... and generate...
<a href="http://blah/blah/blah" style="color: #a8a8a8;">click here</a>
... such that if the stylesheet is updated, the "rendered" HTML will all reflect these changes.
It would be great if this could be used with either inline <style></style>
tags or by using external CSS links
.
I'm doing this because my experience has shown that some (most? all?) of the webmail clients I have used do not appear to honor style information, external or otherwise. If I've missed something here and there is a more simple way to do this, would love to hear about those suggestions too. :)
EDIT I did some more queries and found another Stackoverflow question that discusses CSS Selectors and I think I will try to use something like phpQuery to handle this.