Hi everyone!
I am currently working on a project where I need to make a php version of a flash program we have. We have some XML files with html in them that gets placed into the flash file so new modules can be created quickly. I am working on a php version that can be opened on devices that do not have flash. The issue I am having is font size. I need to ether override the font tags or removed them from the php version. Ideally the flash files and php would pull from the same XML files. I have tried over writing the html font tags with CSS with no success. Any ideas?
Thank you,
James S.
Question: How to override font tag with CSS
Page 1 of 12 Replies - 694 Views - Last Post: 15 April 2011 - 10:10 AM
Replies To: Question: How to override font tag with CSS
#2
Re: Question: How to override font tag with CSS
Posted 15 April 2011 - 08:06 AM
It's going to have to be with CSS because PHP has no control over how things are displayed. In your CSS you can always define a setting as ! important and it will generally override anything that is applied to the tag/class/id.
If your trying to strip the tags before submitting the information for the browser to display you can do it a couple of ways. str_replace would be the simplest solution. Regex solution would be more complicated but more robust.
edit:::: very very crude example using a regex pattern I found with Google.
If your trying to strip the tags before submitting the information for the browser to display you can do it a couple of ways. str_replace would be the simplest solution. Regex solution would be more complicated but more robust.
edit:::: very very crude example using a regex pattern I found with Google.
<?php
$str1 = "<font color=blue size=10>Blue Text</font>";
$str2 = "<font color=blue>Blue Text</font>";
$str3 = "<font>Blue Text</font>";
echo "<h1>Before strip</h1><br/>";
echo $str1 . "<br/>";
echo $str2 . "<br/>";
echo $str3 . "<br/>";
echo str_repeat("_", 254) . "<br/>";
$str1 = preg_replace('#</?font[^>]*>#is', '', $str1);
$str2 = preg_replace('#</?font[^>]*>#is', '', $str2);
$str3 = preg_replace('#</?font[^>]*>#is', '', $str3);
echo "<h1>After strip</h1><br/>";
echo $str1 . "<br/>";
echo $str2 . "<br/>";
echo $str3 . "<br/>";
?>
This post has been edited by RPGonzo: 15 April 2011 - 08:20 AM
#3
Re: Question: How to override font tag with CSS
Posted 15 April 2011 - 10:10 AM
I fixed it, thank you!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|