[eluser]jng[/eluser]
I have made this on my mac, which I realized has the latest version of PHP so my guess is what this is not working?
To remove all the IF ELSE PHP logic from view, I moved it to the model, but maybe this logic is also wrong?
Basically any of the new properties like "foundclass", "hasTruppengattung", etc. don't show up on my webserver with PHP4 and instead just returns "Message: Undefined property: foundclass".
Thank you for any help you can provide.
Code:
<?php
class Bayern_model extends Model {
function getAll() {
$q = $this->db->query("SELECT * FROM people ORDER BY last_name");
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
$data[] = $row;
$date = explode("-",$row->birthdate);
//date("d M Y", mktime(0, 0, 0, $date[0], $date[1], $date[2]))
$row->birthinfo = ($row->birthdate!="0000-00-00") ? "geb. " . date("d M Y", mktime(0, 0, 0, $date[1], $date[2], $date[0])) : "";
$row->birthinfo .= ($row->birthplace!="") ? ", " . $row->birthplace : "";
$row->foundclass = ($row->isFound) ? "found" : "notfound";
$row->hasTruppengattung = ($row->truppengattung!="") ? true : false ;
$row->hasFormation = ($row->formation!="") ? true : false ;
$row->hasTruppenteil = ($row->truppenteil!="") ? true : false ;
$row->hasServiceInfo = ( $row->hasTruppengattung || $row->hasFormation || $row->hasTruppenteil ) ? true : false ;
$row->hasNotes = ($row->notes!="") ? true : false ;
$row->hasSource = ($row->sourceLink!="") ? true : false ;
$row->hasScan = ($row->recordScan!="") ? true : false ;
$row->searchURL = "http://mywebsite/?firstname" . $row->first_name . "&lastname;=" . $row->last_name;
if($row->birthdate!="0000-00-00")
$row->searchURL .= "&birthyear;=" . $date[0];
}
return $data;
}
}
}