-
Notifications
You must be signed in to change notification settings - Fork 1
/
Module.php
85 lines (75 loc) · 2.19 KB
/
Module.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
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
<?php
/**
* This file is part of the PPI Framework.
*
* @category PPI
*
* @copyright Copyright (c) 2011-2015 Paul Dragoonis <paul@ppi.io>
* @license http://opensource.org/licenses/mit-license.php MIT
*
* @link http://www.ppi.io
*/
namespace PPI\SmartyModule;
use PPI\Autoload;
use PPI\Module\AbstractModule;
/**
* PPI Smarty Module.
*
* @author Vítor Brandão <vitor@ppi.io>
*/
class Module extends AbstractModule
{
const VERSION = '0.0.1-DEV';
/**
* {@inheritDoc}
*/
public function init($e)
{
Autoload::add(__NAMESPACE__, dirname(__DIR__));
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'SmartyModule';
}
/**
* {@inheritDoc}
*/
public function getConfig()
{
// return array('smarty' => $this->loadConfig('smarty.php'));
// or
return array('smarty' => require_once __DIR__ . '/resources/config/smarty.php');
}
/**
* {@inheritDoc}
*/
public function getServiceConfig2()
{
/*
* Smarty Engine.
*
$serviceManager->setFactory('templating.engine.smarty', function($serviceManager) use ($appCacheDir) {
$cacheDir = $appCacheDir . DIRECTORY_SEPARATOR . 'smarty';
$smartyEngine = new \PPI\View\Smarty\SmartyEngine(
new \Smarty(),
$serviceManager->get('templating.locator'),
$serviceManager->get('templating.name_parser'),
$serviceManager->get('templating.loader'),
array(
'cache_dir' => $cacheDir . DIRECTORY_SEPARATOR . 'cache',
'compile_dir' => $cacheDir . DIRECTORY_SEPARATOR . 'templates_c',
),
$serviceManager->get('templating.globals'),
$serviceManager->get('logger')
);
// Add some SmartyBundle extensions
$smartyEngine->addExtension(new SmartyAssetsExtension($serviceManager->get('templating.helper.assets')));
$smartyEngine->addExtension(new SmartyRouterExtension($serviceManager->get('router')));
return $smartyEngine;
});
*/
}
}