??? configs: Hosts any special Smarty configuration files you may use for this
particular Web site. The specific purpose of these files is introduced in the
later section ???Creating Configuration Files.???
??? templates_c: Hosts any templates compiled by Smarty.
??? cache: Hosts any templates cached by Smarty, if this feature is enabled.
Although Smarty by default assumes that these directories reside in the same
directory as the script instantiating the Smarty class, it??™s recommended that you
place these directories somewhere outside of your Web server??™s document root.
You can change the default behavior using Smarty??™s $template_dir, $compile_dir,
$config_dir, and $cache_dir class members. For example, you could modify their
locations like so:
CHAPTER 19 ?– TEMPLAT ING WITH SMARTY 477
// Reference the Smarty class library.
require("Smarty.class.php");
// Create a new instance of the Smarty class.
$smarty = new Smarty;
$smarty->template_dir="/usr/local/lib/php/smarty/template_dir/";
$smarty->compile_dir="/usr/local/lib/php/smarty/compile_dir/";
$smarty->config_dir="/usr/local/lib/php/smarty/config_dir/";
$smarty->cache_dir="/usr/local/lib/php/smarty/cache_dir/";
?>
With these steps complete, you??™re ready to begin using Smarty. To whet your appetite
regarding this great templating engine, let??™s begin with a simple usage example,
and then delve into some of the more interesting and useful features.
Pages:
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559