'/presentation/');
define('BUSINESS_DIR', SITE_ROOT . '/business/');
// Settings needed to configure the Smarty template engine
define('SMARTY_DIR', SITE_ROOT . '/libs/smarty/');
define('TEMPLATE_DIR', PRESENTATION_DIR . 'templates');
define('COMPILE_DIR', PRESENTATION_DIR . 'templates_c');
define('CONFIG_DIR', SITE_ROOT . '/include/configs');
?>
Before moving on, let??™s see what is happening here. dirname(__FILE__) returns the parent directory of
the current file; naturally, dirname(dirname(__FILE__)) returns the parent of the current file??™s directory.
This way our SITE_ROOT constant will be set to the full path of tshirtshop. With the help of the
SITE_ROOT constant, we set up absolute paths of Smarty folders.
11. Create a file named application.php in the tshirtshop/presentation folder, and add the following
contents to it:
// Reference Smarty library
require_once SMARTY_DIR . 'Smarty.class.php';
/* Class that extends Smarty, used to process and display Smarty
files */
class Application extends Smarty
{
// Class constructor
public function __construct()
{
// Call Smarty's constructor
parent::Smarty();
// Change the default template directories
$this->template_dir = TEMPLATE_DIR;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
}
}
?>
In application.php, you extend the Smarty class with a wrapper class named Application, which
changes Smarty??™s default behavior.
Pages:
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114