/
recipe.php
57 lines (46 loc) 路 2.07 KB
/
recipe.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
<header>
<?php if(isset($_['image']) && $_['image']) { ?>
<figure>
<img src="<?php echo $_['imageURL']; ?>">
</figure>
<?php } ?>
<h2><?php echo $_['name']; ?></h2>
<p><?php echo $_['recipeYield']; ?> serving<?php if($_['recipeYield'] > 1) { echo 's'; } ?></p>
<p><?php p($l->n('One serving', '%n servings', $_['recipeYield'])); ?></p>
<?php if(isset($_['dailyDozen'])) { ?>
<?php
$daily_dozen = [
'beansAndLegumes' => [ 'icon' => '馃', 'name' => $l->t('Beans and legumes') ],
'berries' => [ 'icon' => '馃崜', 'name' => $l->t('Berries') ],
'cruciferousVegetables' => [ 'icon' => '馃ウ', 'name' => $l->t('Cruciferous vegetables') ],
'flaxseeds' => [ 'icon' => '馃尡', 'name' => $l->t('Flaxseeds') ],
'greens' => [ 'icon' => '馃ガ', 'name' => $l->t('Greens') ],
'nutsAndSeeds' => [ 'icon' => '馃尠', 'name' => $l->t('Nuts and seeds') ],
'otherFruits' => [ 'icon' => '馃崒', 'name' => $l->t('Other fruits') ],
'otherVegetables' => [ 'icon' => '馃', 'name' => $l->t('Other vegetables') ],
'herbsAndSpices' => [ 'icon' => '馃尶', 'name' => $l->t('Herbs and spices') ],
'wholeGrains' => [ 'icon' => '馃崬', 'name' => $l->t('Whole grains') ],
];
?>
<?php foreach($daily_dozen as $id => $ingredient) { ?>
<?php if(strpos($_['dailyDozen'], $id) === false) { continue; } ?>
<span title="<?php echo $ingredient['name']; ?>"><?php echo $ingredient['icon']; ?></span>
<?php } ?>
<?php } ?>
</header>
<aside>
<ul>
<h3><?php p($l->t('Ingredients')); ?></h3>
<?php foreach($_['recipeIngredient'] as $ingredient) { ?>
<li><?php echo $ingredient; ?></li>
<?php } ?>
</ul>
</aside>
<main>
<ul>
<h3><?php p($l->t('Instructions')); ?></h3>
<?php foreach($_['recipeInstructions'] as $step) { ?>
<li><?php echo $step; ?></li>
<?php } ?>
</ul>
</main>