meltingpoint Posted September 13, 2010 Share Posted September 13, 2010 echo "<font style ='background-color: yellow;'>Report #    {$report_number}    Date of Incident:    {$date}</font>"; If works.........I just want to make sure it is ok? What do ya think? Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 13, 2010 Share Posted September 13, 2010 It looks ok, but i would never do it this way. I like to keep my css seperated instead of inline style. Instead of this you could make an easy html element with the class report. In Css you make a .report{}. And in php you just echo an html element with that class. much cleaner and easier to fix. Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 13, 2010 Author Share Posted September 13, 2010 Thanks fortnox- I have done the CSS class before and you're right- I probably should continue to do it that way. However- with the mixing of text and $variables I wanted to test and inline method. I was not sure of using the {} around the variable to isolate it rather than using a bunch of " " and having to escape them. Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 13, 2010 Share Posted September 13, 2010 So for instance: in your css-file: you place .report{ background-color: yellow; } In php you place: echo "<p class="report">Report: {$report_number}<br />Date of Incident: {$date}</p>"; Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 13, 2010 Share Posted September 13, 2010 I was not sure of using the {} around the variable to isolate it rather than using a bunch of " " and having to escape them. {} is pretty nice to use, even if it's not needed just to make it easier to read. If you just start every project with a standard css folder a JS folder a functions folder etc you will will work much faster. Also this way you can make it much more dynamic. you could maybe make 3 reportclasses with green orange and red. All you need to do Is fetch reports, with there classnumber and put classnumber in the html element. like: <echo "<p class="{$color_class}">Report: {$report_number}<br />Date of Incident: {$date}</p>"; Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 13, 2010 Author Share Posted September 13, 2010 Thanks man- great lesson. Cheers- Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 13, 2010 Share Posted September 13, 2010 : ) hehe nice, I am still a newbie and far from advanced, but the more I am around here to better I get. And besides that helping and solving puzzles is fun 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.