SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | // Get the latest variable from Pods URL | |
4 | $id = pods_url_variable('last'); | |
5 | $dragondata = new Pod('dragons', $id); | |
6 | ||
7 | // Getting variables | |
8 | $dragon_code = $dragondata->get_field('code'); | |
9 | $dragon_name = $dragondata->get_field('name'); | |
10 | $dragon_breed = $dragondata->get_field('breed'); | |
11 | $dragon_gender = $dragondata->get_field('gender'); | |
12 | $dragon_coga = $dragondata->get_field('coga'); | |
13 | $dragon_pol = $dragondata->get_field('part_of_a_lineage'); | |
14 | $dragon_lineage = $dragondata->get_field('lineage'); | |
15 | $dragon_generation = $dragondata->get_field('generation'); | |
16 | - | $dragon_mother = $dragondata->get_field('mother'); |
16 | + | $dragon_mother = $dragondata->get_field('mother.id'); |
17 | - | $dragon_father = $dragondata->get_field('father'); |
17 | + | $dragon_father = $dragondata->get_field('father.id'); |
18 | $dragon_armypart = $dragondata->get_field('part_of_an_army'); | |
19 | $dragon_army = $dragondata->get_field('army'); | |
20 | $dragon_partnerava = $dragondata->get_field('partner_available'); | |
21 | $dragon_partner = $dragondata->get_field('partner'); | |
22 | $dragon_partref = $dragondata->get_field('any_refusals'); | |
23 | $dragon_refpart = $dragondata->get_field('refused_partner'); | |
24 | $dragon_children = $dragondata->get_field('children'); | |
25 | $dragon_childwho = $dragondata->get_field('existing_children'); | |
26 | $dragon_gifted = $dragondata->get_field('gifted'); | |
27 | $dragon_gifter = $dragondata->get_field('gifter'); | |
28 | $dragon_giftnotes = $dragondata->get_field('gift_notes'); | |
29 | $dragon_morenotes = $dragondata->get_field('other_notes'); | |
30 | $dragon_url = $dragondata->get_field('permalink'); | |
31 | ||
32 | // Pick the chosen value out of the array - needed for if statements. | |
33 | $dragon_coga2 = $dragondata->get_field('coga.id'); | |
34 | $dragon_generation2 = $dragondata->get_field('generation.id'); | |
35 | $dragon_mother_info = new Pod('dragons', $dragon_mother); | |
36 | $dragon_mother_url = $dragon_mother_info->get_field('permalink'); | |
37 | $base_dragons_url = "http://dragoncreatures.com/dragons"; | |
38 | $dragon_father_info = new Pod('dragons', $dragon_father); | |
39 | $dragon_father_url = $dragon_father_info->get_field('permalink'); | |
40 | ?> | |
41 | <p> </p> | |
42 | <table> | |
43 | <tr> | |
44 | <td> | |
45 | <b>now testing to see if statements will work properly.</b> | |
46 | </td> | |
47 | </tr> | |
48 | <tr> | |
49 | <td> | |
50 | <u>Let's test if the dragon has a mother and if so, who this mother is.</u><BR> | |
51 | <?php | |
52 | if ($dragon_mother != '') | |
53 | { | |
54 | echo $dragondata->display( 'mother' ); | |
55 | echo " is "; | |
56 | echo $dragon_name; | |
57 | echo " 's mother<BR>"; | |
58 | ||
59 | } | |
60 | else | |
61 | { | |
62 | echo ""; //We don't need to display anything if the dragon has no mother. | |
63 | } | |
64 | ?><b>test has succeeded.</b> | |
65 | </td> | |
66 | </tr> | |
67 | <tr> | |
68 | <td> | |
69 | <u>Now let's see if we can have a link with the mother's name.</u><BR> | |
70 | <?php | |
71 | if ($dragon_mother != '') | |
72 | { | |
73 | echo "<a href=\"$base_dragons_url/$dragon_mother_url\">"; | |
74 | echo $dragondata->display( 'mother' ); | |
75 | echo "</a>"; | |
76 | echo " is "; | |
77 | echo $dragon_name; | |
78 | echo " 's mother<BR>"; | |
79 | ||
80 | } | |
81 | else | |
82 | { | |
83 | echo ""; //We don't need to display anything if the dragon has no mother. | |
84 | } | |
85 | ?> <b>Test has succeeded</b> </td> | |
86 | </tr> | |
87 | <tr> | |
88 | <td> | |
89 | <u>Let's test if the dragon has a father and if so, who the father is.</u><BR> | |
90 | <?php | |
91 | if ($dragon_father != '') | |
92 | { | |
93 | echo $dragondata->display( 'father' ); | |
94 | echo " is "; | |
95 | echo $dragon_name; | |
96 | echo " 's father<BR>"; | |
97 | ||
98 | } | |
99 | else | |
100 | { | |
101 | echo ""; //We don't need to display anything if the dragon has no father. | |
102 | } | |
103 | ?><b>Test has succeeded</b> | |
104 | </td> | |
105 | </tr> | |
106 | <tr> | |
107 | <td> | |
108 | <b><font color="red">Now let's see if we can have a link with the father's name.</font></b><BR> | |
109 | <?php | |
110 | if ($dragon_father != '') | |
111 | { | |
112 | echo "<a href=\"$base_dragons_url/$dragon_father_url\">"; | |
113 | echo $dragondata->display( 'father' ); | |
114 | echo "</a>"; | |
115 | echo " is "; | |
116 | echo $dragon_name; | |
117 | echo " 's father<BR>"; | |
118 | ||
119 | } | |
120 | else | |
121 | { | |
122 | echo ""; //We don't need to display anything if the dragon has no father. | |
123 | } | |
124 | ?> <b><font color="red">Test failed, link is from the mother despite the coding for the father.</font></b> </td> | |
125 | </tr> | |
126 | </table> |