-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
56 lines (39 loc) · 1.36 KB
/
index.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
<?php
/**
* Front page
*/
$relative_path = "";
require($relative_path . 'settings.php');
include ($relative_path . "cache.php");
$page = 'front-page';
require($relative_path . "common.php");
//get countries
$parliaments = json_decode(file_get_contents(APP_PATH . "inc/parliaments.json"));
$selected_countries = selected_countries($parliaments);
//get categories
$categories = json_decode(file_get_contents(APP_PATH . "inc/categories.json"));
$categories_sorted = sort_categories($categories);
//read jumbo.md
include('Parsedown.php');
$mdurl = TEXT_URL . lang($page) . "/front-page/jumbo.md";
$contents = file_get_contents($mdurl);
$Parsedown = new Parsedown();
//include texts
//categories
$handle = fopen(TEXT_PATH . $lang . DIRECTORY_SEPARATOR . 'meta' . DIRECTORY_SEPARATOR . 'categories.csv', "r");
$categories_texts = csv2array($handle);
// print_r($categories_texts);die();
$smarty->assign('countries',json_encode($selected_countries));
$smarty->assign('categories',$categories_sorted);
$smarty->assign('jumbo_text',ltrim($Parsedown->text($contents),'<p>'));
$smarty->assign('categories_texts',$categories_texts);
$smarty->assign('relative_path',$relative_path);
$smarty->display($page . '.tpl');
function sort_categories($categories) {
$out = [];
foreach ($categories as $c)
$out[] = $c;
usort($out, 'compare_weights');
return $out;
}
?>