[eluser]arylaarsdam[/eluser]
Code:
function index($mypropertyid) {
$this->load->model('property_model');
$this->load->model('user_model');
$session = array(
'lastviewedproperty' => $mypropertyid
);
$this->session->set_userdata($session);
//Converts MyPropertyID into PropertyID
$query = $this->property_model->read_propertyid($mypropertyid);
$propertyid = $query['propertyid'];
//Checks if user already saved this listing if the user is logged in
if($this->session->userdata('is_logged_in') == TRUE)
{
$data['checksaved'] = $this->user_model->read_checksaved($propertyid);
}
else
{
$data['checksaved'] = 0;
}
//Gets listing details
$data['location'] = $this->property_model->read_location($propertyid);
$data['visits'] = $this->property_model->read_visits($propertyid);
$data['listingstatus'] = $this->property_model->read_listingstatus($propertyid);
$data['basicdetails'] = $this->property_model->read_basicdetails($propertyid);
$data['additionaldetails'] = $this->property_model->read_additionaldetails($propertyid);
$data['pictures'] = $this->property_model->read_pictures($propertyid);
$data['primarypicture'] = $this->property_model->read_primarypicture($propertyid);
$data['openhouses'] = $this->property_model->read_openhouses($propertyid);
$data['taxes'] = $this->property_model->read_taxes($propertyid);
$data['neighborhood'] = $this->property_model->read_neighborhood($propertyid);
$data['schools'] = $this->property_model->read_schools($propertyid);
$data['myid'] = $query['MyID'];
$price = $data['listingstatus']['Price'];
$zip = $data['location']['Zip'];
$zwsid = 'MyZillowAPIKey'; //This is My Zillow ZWS-ID for API use.
$down = '10'; //This is the downpayment percentage default. Perhaps in the future can make this dynamic based on user input.
$data['monthlypayments'] = $this->property_model->getmonthlypayments($price, $down, $zip, $zwsid);
$data['main_content'] = 'property/detail';
$this->property_model->add_visit($propertyid);
$this->load->view('includes/template_propertydetail', $data);
}