PHP Coding help - newbie
Posted: Sun Aug 22, 2010 2:56 pm
Good day people, got this open source script for a dog pedigree database on the net. I have no programming skills at all.
Need some help with the script, i want to change the font color of the Sire's side of the pedigree that is displayed , but have no idea how to do it, any help would be appreciated.
Example of displayed pedigree - http://www.sa-apbt.co.za/details.php?id=63854
below are the code.
Thanks in advance
Need some help with the script, i want to change the font color of the Sire's side of the pedigree that is displayed , but have no idea how to do it, any help would be appreciated.
Example of displayed pedigree - http://www.sa-apbt.co.za/details.php?id=63854
below are the code.
Thanks in advance
Code: Select all
<?php
function DbTriad($dogVO, $level, $generations, $childText) {
global $THUMBNAIL_WIDTH;
global $dogDAO;
# do the individual.
if ($level == $generations) {
echo "<TD >";
} else {
echo "<TD ROWSPAN=" . pow(2,($generations - $level));
echo " >";
}
if (($dogVO != -1) && (!empty($dogVO ))) {
if (empty($dogVO)) {
echo "Unknown Individual";
} else {
$name = $dogVO->name;
$sireId = $dogVO->sire->id;
$damId = $dogVO->dam->id;
$landofbirth = $dogVO->landofbirth;
$yearofbirth = $dogVO->yearofbirth;
$color = $dogVO->color;
$title = $dogVO->title;
$photo = $dogVO->photo->thumb_ref;
if (empty($photo))
$photo = $dogVO->photo->reference;
}
### Highlight title w/ Blue font
if (!empty($title)) {
echo "<label>";
echo "<font color=\"blue\">$title</font><BR>";
echo "</label>";
}
echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$dogVO->id.'">';
if (!empty($photo)) {
echo '<p><img SRC="'.$photo.'" width="'.$THUMBNAIL_WIDTH.'"></p>';
}
echo "$name</a>";
echo "<label>";
//if (($level <= 3) && (!empty($color))) {
if (!empty($color)) {
echo "<BR>$color ";
}
if (!empty($landofbirth)) {
echo "<BR>$landofbirth";
}
if (!empty($yearofbirth)) {
echo "<BR>$yearofbirth";
}
echo "</label>";
}
else {
echo " ";
if (!empty($childText) )
echo '<a href="addDog.php?child='.$childText.'">Add Dog</a>';
}
echo "</TD>";
# do the father.
if ($level < $generations) {
if (!empty($dogVO))
$childText = "fatherOf_".$dogVO->id;
else
unset($childText);
$dogDAO = new DogDAO();
if (empty($sireId))
$father = null;
else
$father = $dogDAO->get($sireId);
DbTriad($father, $level + 1, $generations, $childText);
}
# do the mother.
if ($level < $generations) {
if (!empty($dogVO))
$childText = "motherOf_".$dogVO->id;
else
unset($childText);
$dogDAO = new DogDAO();
if (empty($damId))
$mother = null;
else
$mother = $dogDAO->get($damId);
DbTriad($mother, $level + 1, $generations, $childText);
}
# finish up.
if ($level == $generations) {
echo "</TR><TR>";
}
}
# begin table
echo '<table id="pedigree" align="center" width="96%" border="0"><tr><th colspan='.$generations.'>Pedigree of '.$dog->name.' '.$dog->title.'</th></tr>';
# do tree.
$dogDAO = new DogDAO();
$dog = $dogDAO->get($currId);
DbTriad ($dog, 1, $generations, null);
# end table
echo "</td></tr></table>";
?>