Prev | Current Page 103 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

The Application class uses its constructor to configure the Smarty
folders you created earlier.
CHAPTER 3 ?–  STARTING THE TSHIRTSHOP PROJECT 46
?– Tip As mentioned earlier, Smarty requires three folders to operate: templates, templates_c, and
configs. In the constructor of the Application class, we set a separate set of these directories for our
application. If you want to turn on caching, then Smarty also needs a directory named cache.We will not be
using Smarty caching for TShirtShop, but you can read more details about this in the Smarty manual at
http://smarty.php.net/manual/en/caching.php.
12. Add the index.php file to the tshirtshop folder. The role of this file is to load the store_front.tpl
template by using the Application class you created earlier. Here??™s the code for index.php:
// Include utility files
require_once 'include/config.php';
// Load the application page template
require_once PRESENTATION_DIR . 'application.php';
// Load Smarty template file
$application = new Application();
// Display the page
$application->display('store_front.tpl');
?>
13. Now it??™s time to see some output from this thing. Load http://localhost/tshirtshop/ in your favorite
web browser, and admire the results, shown in Figure 3-9.
?– Tip At this early point of the development process it is probably a good idea to bookmark your
tshirtshop location in your web browser (or browsers) that you use for development.


Pages:
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115