<?php
// Get the latest variable from Pods URL
$id = pods_url_variable('last');
$dragondata = new Pod('dragons', $id);
// Getting variables
$dragon_code = $dragondata->get_field('code');
$dragon_name = $dragondata->get_field('name');
$dragon_breed = $dragondata->get_field('breed');
$dragon_gender = $dragondata->get_field('gender');
$dragon_coga = $dragondata->get_field('coga');
$dragon_pol = $dragondata->get_field('part_of_a_lineage');
$dragon_lineage = $dragondata->get_field('lineage');
$dragon_generation = $dragondata->get_field('generation');
$dragon_mother = $dragondata->get_field('mother.id');
$dragon_father = $dragondata->get_field('father.id');
$dragon_armypart = $dragondata->get_field('part_of_an_army');
$dragon_army = $dragondata->get_field('army');
$dragon_partnerava = $dragondata->get_field('partner_available');
$dragon_partner = $dragondata->get_field('partner');
$dragon_partref = $dragondata->get_field('any_refusals');
$dragon_refpart = $dragondata->get_field('refused_partner');
$dragon_children = $dragondata->get_field('children');
$dragon_childwho = $dragondata->get_field('existing_children');
$dragon_gifted = $dragondata->get_field('gifted');
$dragon_gifter = $dragondata->get_field('gifter');
$dragon_giftnotes = $dragondata->get_field('gift_notes');
$dragon_morenotes = $dragondata->get_field('other_notes');
$dragon_url = $dragondata->get_field('permalink');
// Pick the chosen value out of the array - needed for if statements.
$dragon_coga2 = $dragondata->get_field('coga.id');
$dragon_generation2 = $dragondata->get_field('generation.id');
$dragon_mother_info = new Pod('dragons', $dragon_mother);
$dragon_mother_url = $dragon_mother_info->get_field('permalink');
$base_dragons_url = "http://dragoncreatures.com/dragons";
$dragon_father_info = new Pod('dragons', $dragon_father);
$dragon_father_url = $dragon_father_info->get_field('permalink');
?>
<p> </p>
<table>
<tr>
<td>
<b>now testing to see if statements will work properly.</b>
</td>
</tr>
<tr>
<td>
<u>Let's test if the dragon has a mother and if so, who this mother is.</u><BR>
<?php
if ($dragon_mother != '')
{
echo $dragondata->display( 'mother' );
echo " is ";
echo $dragon_name;
echo " 's mother<BR>";
}
else
{
echo ""; //We don't need to display anything if the dragon has no mother.
}
?><b>test has succeeded.</b>
</td>
</tr>
<tr>
<td>
<u>Now let's see if we can have a link with the mother's name.</u><BR>
<?php
if ($dragon_mother != '')
{
echo "<a href=\"$base_dragons_url/$dragon_mother_url\">";
echo $dragondata->display( 'mother' );
echo "</a>";
echo " is ";
echo $dragon_name;
echo " 's mother<BR>";
}
else
{
echo ""; //We don't need to display anything if the dragon has no mother.
}
?> <b>Test has succeeded</b> </td>
</tr>
<tr>
<td>
<u>Let's test if the dragon has a father and if so, who the father is.</u><BR>
<?php
if ($dragon_father != '')
{
echo $dragondata->display( 'father' );
echo " is ";
echo $dragon_name;
echo " 's father<BR>";
}
else
{
echo ""; //We don't need to display anything if the dragon has no father.
}
?><b>Test has succeeded</b>
</td>
</tr>
<tr>
<td>
<b><font color="red">Now let's see if we can have a link with the father's name.</font></b><BR>
<?php
if ($dragon_father != '')
{
echo "<a href=\"$base_dragons_url/$dragon_father_url\">";
echo $dragondata->display( 'father' );
echo "</a>";
echo " is ";
echo $dragon_name;
echo " 's father<BR>";
}
else
{
echo ""; //We don't need to display anything if the dragon has no father.
}
?> <b><font color="red">Test failed, link is from the mother despite the coding for the father.</font></b> </td>
</tr>
</table>