Restyled Miscellaneous Billing Options HCFA with help file (#1713)
[openemr.git] / vendor / smarty / smarty / QUICK_START
blob6ae3e466a074192d0650389e6a0b9d9b0faa7864
1 This is a simple guide to get Smarty setup and running quickly. The online
2 documentation includes a very thorough explanation of a Smarty installation.
3 This guide is meant to be a quick and painless way of getting Smarty working,
4 and nothing more. The guide assumes you are familiar with the UNIX system
5 environment. Windows users will need to make adjustments where necessary.
7 INSTALL SMARTY LIBRARY FILES
9 Copy the Smarty library files to your system. In our example, we place them in
10 /usr/local/lib/php/Smarty/
12 $> cd YOUR_DOWNLOAD_DIRECTORY
13 $> gtar -ztvf Smarty-2.6.7.tar.gz
14 $> mkdir /usr/local/lib/php/Smarty
15 $> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
17 You should now have the following file structure:
19 /usr/local/lib/php/Smarty/
20                           Config_File.class.php
21                           debug.tpl
22                           internals/
23                           plugins/
24                           Smarty.class.php
25                           Smarty_Compiler.class.php
28 SETUP SMARTY DIRECTORIES
30 You will need four directories setup for Smarty to work. These files are for
31 templates, compiled templates, cached templates and config files. You may or
32 may not use caching or config files, but it is a good idea to set them up
33 anyways. It is also recommended to place them outside of the web server
34 document root. The web server PHP user will need write access to the cache and
35 compile directories as well.
37 In our example, the document root is /web/www.domain.com/docs and the
38 web server username is "nobody". We will keep our Smarty files under
39 /web/www.domain.com/smarty
41 $> cd /web/www.domain.com
42 $> mkdir smarty
43 $> mkdir smarty/templates
44 $> mkdir smarty/templates_c
45 $> mkdir smarty/cache
46 $> mkdir smarty/configs
47 $> chown nobody:nobody smarty/templates_c
48 $> chown nobody:nobody smarty/cache
49 $> chmod 775 smarty/templates_c
50 $> chmod 775 smarty/cache
53 SETUP SMARTY PHP SCRIPTS
55 Now we setup our application in the document root:
57 $> cd /web/www.domain.com/docs
58 $> mkdir myapp
59 $> cd myapp
60 $> vi index.php
62 Edit the index.php file to look like the following:
64 <?php
66 // put full path to Smarty.class.php
67 require('/usr/local/lib/php/Smarty/Smarty.class.php');
68 $smarty = new Smarty();
70 $smarty->template_dir = '/web/www.domain.com/smarty/templates';
71 $smarty->compile_dir = '/web/www.domain.com/smarty/templates_c';
72 $smarty->cache_dir = '/web/www.domain.com/smarty/cache';
73 $smarty->config_dir = '/web/www.domain.com/smarty/configs';
75 $smarty->assign('name', 'Ned');
76 $smarty->display('index.tpl');
81 SETUP SMARTY TEMPLATE
83 $> vi /web/www.domain.com/smarty/templates/index.tpl
85 Edit the index.tpl file with the following:
87 <html>
88 <head>
89 <title>Smarty</title>
90 </head>
91 <body>
92 Hello, {$name}!
93 </body>
94 </html>
98 Now go to your new application through the web browser,
99 http://www.domain.com/myapp/index.php in our example. You should see the text
100 "Hello Ned!" in your browser.
102 Once you get this far, you can continue on to the Smarty Crash Course to learn
103 a few more simple things, or on to the documentation to learn it all.