Creating the Environment
The first thing to do is to create an empty application development environment. Without going into the basic details let’s see the structure here. In Linux/Unix it is common to have a symbolic/soft link but in Windows it is easier to rename the Smarty-x.x.xx directory to "smarty". As of writing this the Smarty templating engine is in version 3.1.x. Whatever the version might be the instructions should be the same.
Some explanation is obviously necessary.
/[web application root] is the root of the application containing the index file (index.php) and the .htaccess file
/admin is reserved for future site administration
/cache is reserved for possible future Smarty intelligent caching
/configs is reserved for configuration settings
/css should be self-explanatory
/files contains images, videos, sounds, pdfs etc we want to serve to the world. This needs to be writable!
/include contains some simple included things
/js contains the Javascript libraries
/libs contains various libraries like the Smarty library.
/modules contains the modules we develop. We will have a closer look at the directory structure later
/templates contains the main source templates excluding the module templates
/templates_c contains the compiled templates. This must be writable by the web server software.
To make the files and templates_c directories writable you must set their rights to 0x777 in Linux/Unix. Okay, here is a skeleton you can run in your website root directory in your linux/freebsd shell:
We will have a few additional directories and may need more depending on our needs. NOTE: It is not a good idea to have all these accessible under the web root. For the sake of simplicity we have placed them all there. After you have got the idea it is totally up to you to create a better directory structure.
So what we will do is save the settings in the /configs directory with a good name, say "mysettings.txt" or something alike, read and parse it and store the stuff to the registry. For the sake of simplicity the structure of the file is like this: