| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Oct 2004
Location: Bristol
Posts: 2,804
|
removing Html tag attributes in php
anyone know a good way to do this? got a CMS which is accepting style attributes for the <p> tag, which then override my css styles on the site. Need to keep the <p> tag just remove all it's attrinbutes; so <p style="margin: 0px; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal"> becomes <p> |
|
|
|
|
|
#2 (permalink) |
|
Spare Parts
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,287
|
You mean the CMS is creating this styling in the out put and you want to stop it? If that is the case you need to search the source code of the CMS for eg. style="margin and just remove that styling in the instances it appears. If no results try style=\"margin in case is escaped in code. If I understand you correctly? |
|
|
|
#5 (permalink) |
|
unusual suspect ™
Join Date: Jul 2004
Location: DE, USA
Posts: 2,511
|
Word's a cunt. Copy into notepad first (tell your clients to) then paste into the CMS's HTML editor. Don't even bother trying to clear out the Word shite that's added through code as there are so many versions of Word that the content may come from and they all tow their own crap behind them. |
|
|
|
#6 (permalink) |
|
Senior Member
Join Date: Oct 2004
Location: Bristol
Posts: 2,804
|
finally used preg_replace('/<p\b[^>]*+>/', '', $string); @seen to, I've used strip_tags to get rid of anything else word may chuck at me, the <p> tag was an exception (along with bold and italic),so hopefully this should do it - Word is a cunt though |
|
![]() |