-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathe_print.php
46 lines (37 loc) · 1.19 KB
/
e_print.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
<?php
/*
* CookBook - an e107 plugin by Tijn Kuyper (http://www.tijnkuyper.nl)
*
* Released under the terms and conditions of the
* Apache License 2.0 (see LICENSE file or http://www.apache.org/licenses/LICENSE-2.0)
*
*/
class cookbook_print
{
function render($rid)
{
$tp = e107::getParser();
$sql = e107::getDb();
$text = '';
$rid = intval($rid);
// Load the LAN files
e107::lan('cookbook', false, true);
// Load template and shortcodes
$sc = e107::getScBatch('cookbook', true);
$template = e107::getTemplate('cookbook');
$template = array_change_key_case($template);
if($recipe = $sql->retrieve("cookbook_recipes", "*", "r_id = '{$rid}'"))
{
// Set wrapper
$sc->wrapper('cookbook/print_recipe_layout');
// Pass database info onto the shortcodes
$sc->setVars($recipe);
$text = e107::getParser()->parseTemplate($template['print_recipe_layout'], true, $sc);
}
else
{
$text = e107::getParser()->parseTemplate("{LAN=LAN_CB_RECIPENOTFOUND}", true);
}
return $text;
}
}