-
Notifications
You must be signed in to change notification settings - Fork 0
/
poke.php
81 lines (69 loc) · 3.46 KB
/
poke.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pokeapi</title>
<link rel="icon" href="./images/favicon.ico">
<link rel="stylesheet" href="./../css/style.css">
</head>
<body id="pokepage">
<?php
require_once './php/connections.php';
$pokeimage = 'http://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/'.$pokemon['id'].'.png"';
//POKE CARD INFO
echo '<div class="bigcard">';
echo '<a href="../" class="returntohome">Close</a>';
echo '<div class="cardhead">';
echo '<img class="imgpoke" src="'.$pokeimage.'" onerror="imgError(this);" alt="Poekmon -'.$pokemon['name'].'">';
echo '<h2 class="poke-title fontb">'.$pokemon['name'].'</h2>';
echo '<div class="card-info-stats">';
foreach ($pokemon['stats'] as $stat) {
echo '<p><span class="fontb">'.$stat['stat']['name'].'</span>: '.$stat['base_stat'].'</p>';
}
echo '<p><span class="fontb">Height: </span>'.$pokemon['height'].'</span></p>';
echo '<p><span class="fontb">Weight: </span>'.$pokemon['weight'].'</span></p>';
echo '<p><span class="fontb">Base experience: </span>'.$pokemon['base_experience'].'</span></p>';
echo '<p><span class="fontb">Base happiness:'. $pokemmonSpecie['base_happiness'].' </span></p>';
echo '<p><span class="fontb">Capture Rate:'. $pokemmonSpecie['capture_rate'].' </span></p>';
echo '</div></div>';
echo '<div class="midlecard">';
echo '<div class="card-info-midd br">';
echo '<div class="fontb mt20 font15">'. $pokemmonSpecie['flavor_text_entries'][2]['flavor_text'].' </div>';
echo '<div class="fontb mt20">Color:'. $pokemmonSpecie['color']['name'].' </div>';
echo '<div class="fontb mt20">Gender:'. $pokemmonSpecie['genera'][7]['genus'].' </div>';
echo '<div class="fontb mt20">'. $generationName['names'][5]['name'].' </div>';
if(empty($pokemmonSpecie['habitat']['name'])){
echo "";
}else{
echo '<div class="fontb mt20">Where to find:'. $pokemmonSpecie['habitat']['name'].' </div>';
}
echo '</div>';
echo '</div>';
echo '<div class="twoparts">';
echo '<div class="fifty">';
echo '<h2 class="fontb">Abilities:</h2>';
foreach ($pokemon['abilities'] as $ability){
echo '<span class="fontb">'.$ability['ability']['name'].'</span>';
}
echo '</div>';
echo '<div class="fifty">';
echo '<h2 class="fontb">Types:</h2>';
foreach ($pokemon['types'] as $type) {
echo '<span class="fontb">'.$type['type']['name'].'</span>';
}
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
?>
</body>
<script>
function imgError(image) {
image.onerror = "";
image.src = "../images/imagenotfound.jpg";
return true;
}
</script>
</html>