I am coding a plugin for our company's stock price. I am determining growth as such:
public function __construct(){
$this->EE =& get_instance();
$fp = fopen ("http://finance.yahoo.com/d/quotes.csv?s=EDR&f=sl1c1pohgv&e=.csv","r");
$retData = fgetcsv ($fp, 1000, ",");
$this->return_data = round($retData[2]/$retData[3]*100,2);
}
where $retData[2] is "change" and $retData[3] is "previous close."
My returned data is something like -0.19% which I can output in a template using {exp:edrstock}%.
Now the question: I need to create a conditional set of if/else tags so that if the number is negative I output it in a div with a class of "negStock" or if it is even, I output it in a div with a class of "evenStock" and if it is positive, I output it in a div with a class of "posStock."
By the way, the class will determine what color the text is and whether or not it appears in the header (positive) or the footer (even or negative).
I would appreciate any guidance as I am teaching myself EE from a book and would like to learn this the right way.
Thanks in advance, Jon