Jump to content


Photo

strip_tags while keeping only font color=


  • Please log in to reply
6 replies to this topic

#1 rodin

rodin
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 18 September 2006 - 03:16 PM

I want to strip all html tags, EXCEPT want to keep the BOLD and the actual font color= , while getting rid of font size and font face, so where right now I get
<font face="Verdana" size=2>
<b><font color="#00FFFF">rodin</font></b>

I've accomplished keeping the bold, by using the strip_tags then < b >, but haven't accomplished keeping just the font COLOR and closing the font COLOR.  Is this possible as well?

Thanks for the great support here!

#2 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 18 September 2006 - 03:23 PM

<?php

$string = strip_tags($string, '<font>');

?>

It helps to read the manual.

#3 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 18 September 2006 - 03:28 PM

Jenk,

He only wants to keep parts of the <font> tag, not all of it...

It helps to read the post  ;D

Having said that, there is a good example on the manual page that a user has posted on how to achieve what you want.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#4 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 18 September 2006 - 03:39 PM

Having said that, there is a good example on the manual page that a user has posted on how to achieve what you want.

;)

#5 rodin

rodin
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 18 September 2006 - 06:10 PM

Yes no need to be a smarty pants ;)  I even tried to find the answer myself via google and many other means before posing the question ;)

#6 rodin

rodin
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 18 September 2006 - 06:57 PM

got it working anyway! :)

#7 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 18 September 2006 - 09:44 PM

Rodin, care to share?

Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users