Jump to content

PHP Coding help - newbie

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
mot777mot

mot777mot

    Newbie

  • Members
  • Pip
  • 2 posts
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 - SA APBT Database
below are the code.
Thanks in advance

<?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>";


 ?>


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
This script is ancient. You may want to try modifying the following line, replacing the color blue with the new color or hexadecimal equivalent.

echo "<font color=\"blue\">$title</font><BR>";


#3
mot777mot

mot777mot

    Newbie

  • Members
  • Pip
  • 2 posts
Thanx for the response,
I've tried modifying that piece of code but it only changes the Colour of the Titles ontop of the dogs name.
i would like to set the male and female's names in the pedigree that is generated in 2 different colours?