[eluser]Unknown[/eluser]
I'm quite sure I followed the user guide, but I may be missing something. I have a custom class that I've placed in the app/lib folder and I think I'm calling it correctly, but the next page doesn't load when I load the class in the index function.
Here's the controller
Code:
<?php
class Timevalueshow extends Controller{
$this->load->library('timevalue');
function index(){
$this->load->view('Timevalueshow_view');
return true;
}
}
And the lib
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Timevalue{
private $years;
private $rate;
private $principle;
private $periods;
private $isCont;
//zeros to test
function Timevalue(0,0, 0, 0, 0) {
$this->years = $years;
$this->rate = $rate;
$this->principle = $principle;
$this->periods = $periods;
$this->isCont = $isCont;
}
//General Getters
function getYears(){
return $this->years;
}
function getRate(){
return $this->rate;
}
function getPrinciple(){
return $this->principle;
}
function getPeriods(){
return $this->periods;
}
//Factors
function FVFactor(){
if($this->isCont){
$new_rate = $this->rate / $this->periods;
$new_periods = $this->periods * $this->years;
return pow(1+$new_rate,$new_periods);
}
else{
return exp($this->rate*$this->years);
}
}
function PVFactor(){
if($this->isCont){
return pow($this->FVFactor(),-1);
}
else{
return pow($this->FVFactor(),-1);
}
}
//General Print
function leprint(){
echo "<br />Years: " . $this->years;
echo "<br />Rate(dec): " . $this->rate;
echo "<br />Principle: $" . $this->principle;
echo "<br /># of Periods: " . $this->periods;
echo "<br />isCont: " . ($this->isCont ? "True" : "False");
}
}
?>