PHP
// this Just Initializes Smarty with The Locations of the // Director IT Will Use
$ FULL_PATH
=
DIRNAME
(
__File__
).
"/"
;
Define
(
"Smarty_dir"
,
$ FULL_PATH
.
"libs / smarty /"
);
Define
(
"Templates_Path"
,
$ FULL_PATH
.
Templates
);
Define
(
"Templates_Path"
,
$ FULL_PATH
.
Templates_c "
);
Define
(
"Configs_path"
,
$ FULL_PATH
.
"configs"
);
Define
(
"Cache_path"
,
$ FULL_PATH
.
"cache"
Require_once
Smarty_dir
.
"Config_file.class.php"
Require_once
Smarty_dir
.
"Smarty.class.php"
;
// Initialize a new smarty object
$ smarty
= New
Smarty
();
// Assign Some Variables in Our Templates File
$ smarty
->
ASSIGN
(
"Title"
,
Smarty Introduction
);
$ smarty
->
ASSIGN
(
"body"
,
Hello there. "
);
// THANKS GoES out to the authors of smarty // Note We Are Appending Here and Filling in a Dynamic Section
$ smarty
->
Append
(
"first"
,
"Monte"
);
$ smarty
->
Append
(
"last"
,
"Ohrt"
);
$ smarty
->
Append
(
"first"
,
"Andrei"
);
$ smarty
->
Append
(
"last"
,
Zmievski
);
// Show the template
$ smarty
->
DISPLAY
(
"INDEX.TPL"
);
?>
INDEX.TPL
Examples / Smarty / Templates / Index.tpl