Schlo_50 Posted February 11, 2008 Share Posted February 11, 2008 Hey guys, I have some values pulled from a .txt file which are echo'ed out on a page. E.g Value1, Value2, Value3, Value4 What i'd like to do is get some code to highlight each output in this order: red, yellow and blue. E.g Red | Yellow | Blue | Red Value1 | Value2 | Value3 | Value4 I have so far attempted this but need some help/ideas about what to try next? $lines = file("file.txt"); //open file foreach ($lines as $line) { $data[$key] = explode("|", $line); $catname = trim($data[$key][1]); //define data needed $a = "<font style=\"background-color: red\" size=\"3\">"; //red html highlight $b = "<font style=\"background-color: yellow\" size=\"3\">"; //yellow html highlight $c = "<font style=\"background-color: blue\" size=\"3\">"; //blue html highlight $array = array($a, $b, $c); //i think i need to use a array? print '<strong>'.$catname.'</strong></font>'; // print values and html highlight Thanks in advance! Quote Link to comment Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 Would probably be easier to use CSS for this. Quote Link to comment Share on other sites More sharing options...
Schlo_50 Posted February 11, 2008 Author Share Posted February 11, 2008 Ok, but there must be a way to use php :-\ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.