-
Notifications
You must be signed in to change notification settings - Fork 18
/
home.template
108 lines (88 loc) · 2.83 KB
/
home.template
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Portions of this program are derived from publicly licensed software
* projects including, but not limited to phpBB, Magelo Clone,
* EQEmulator, EQEditor, and Allakhazam Clone.
*
* Author:
* Maudigan(Airwalking)
*
* April 3, 2020 - Maudigan
* Initial revision
*
***************************************************************************/
/*********************************************
INCLUDES
*********************************************/
//define this as an entry point to unlock includes
if ( !defined('INCHARBROWSER') )
{
define('INCHARBROWSER', true);
}
include_once(__DIR__ . "/include/common.php");
include_once(__DIR__ . "/include/db.php");
/*********************************************
GATHER RELEVANT PAGE DATA
*********************************************/
//get server data
$tpl = <<<TPL
SELECT 'some data' as firstcol,
'more data' as secondcol,
'even more data' as thirdcol
FROM DUAL
WHERE 'example' = '%s'
TPL;
$query = sprintf($tpl, 'example');
$result = $cbsql->query($query);
//no rows?
$rows = $cbsql->rows($result);
if (!$rows) {
$cb_error->message_die($language['MESSAGE_NOTICE'],$language['MESSAGE_NO_RESULTS_ITEMS']);
}
$output = array();
while($row = $cbsql->nextrow($result)) {
$output[] = array(
'FIRSTCOL' => $row['firstcol'],
'SECONDCOL' => $row['secondcol'],
'THIRDCOL' => $row['thirdcol']
);
}
/*********************************************
DROP HEADER
*********************************************/
$d_title = $subtitle;
include(__DIR__ . "/include/header.php");
/*********************************************
POPULATE BODY
*********************************************/
$cb_template->set_filenames(array(
'body' => 'home_body.tpl')
);
//output page vars
$cb_template->assign_both_vars(array(
'ROWS' => number_format($rows)." row(s)")
);
//output page language
$cb_template->assign_vars(array(
'L_HOME' => $language['HOME_HOME'],
'L_COL1' => $language['HOME_COL1'],
'L_COL2' => $language['HOME_COL2'],
'L_COL3' => $language['HOME_COL3'])
);
//output data rows
foreach ($output as $row) {
$cb_template->assign_both_block_vars('rows', $row);
}
/*********************************************
OUTPUT BODY AND FOOTER
*********************************************/
$cb_template->pparse('body');
$cb_template->destroy();
include(__DIR__ . "/include/footer.php");
?>