-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
72 lines (45 loc) · 2.11 KB
/
Copy pathindex.php
File metadata and controls
72 lines (45 loc) · 2.11 KB
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
<?php
session_start();
/** Absolute path to the store directory. */
if (!defined('ABSPATH')) {
define('ABSPATH', __DIR__ . '/');
}
if (!defined('storeadmin')) {
define('storeadmin', false);
}
require_once dirname(__FILE__) . '/inc/db.php'; // Connect to database
require_once dirname(__FILE__) . '/vendor/autoload.php'; //Smarty
$smarty = new \Smarty\Smarty; //Start smarty
$templateDir = dirname(__FILE__) . "/templates/default/";
$smartyTemplateDir = "/templates/default/";
$smarty->force_compile = false; // Dont force recompile when live
$smarty->debugging = false; // Deactivate when out of dev for test
$smarty->cache_lifetime = 21600; //120
$smarty->setTemplateDir($templateDir);
$smarty->assign('template_dir', $smartyTemplateDir);
$smarty->registerPlugin('modifier', '_', '_');
// Load all shop settings from databse and assign all with autoload enabled
$stmt = $dbh->prepare("SELECT columnName,columnValue FROM {$dbprefix}settings WHERE autoload = 1");
$result = $stmt->execute();
while ($setting = $stmt->fetch(PDO::FETCH_ASSOC)) {
// Assign values to be used in files
$_SETTING[$setting['columnName']] = $setting['columnValue'];
// Assign values to smarty for use in templates.
$smarty->assign('setting' . ucfirst($setting['columnName']) . '', $setting['columnValue']); // Save setting for smarty
}
// SEO : Load the current URL from permalinks including meta for this URL
include_once dirname(__FILE__) . '/inc/seo.php';
// If no cache of this page is done, then we need to load all functions etc. to make the cache file.
$cacheId = $_SETTING['smartyCacheId'] ?? null;
if ($smarty->caching && $cacheId) {
if (!$smarty->isCached($smartyTemplateFile, $cacheId)) {
// Load template functions
include_once dirname(__FILE__) . '/inc/templateFunctions.php';
}
$smarty->display($smartyTemplateFile, $cacheId);
} else {
// Enten caching = false, eller ingen cacheId → vis uden cache
// Load template functions
include_once dirname(__FILE__) . '/inc/templateFunctions.php';
$smarty->display($smartyTemplateFile);
}