Phraw depends on external libraries but no one is required. It is suggested to download and install Smarty as template engine because it is fast, powerful and easy to use.
The faster way to install Phraw is to download a pre-packaged distribution. You should start with the vanilla distribution that contains Phraw and Smarty.
Follow the instructions:
The debugging is set to True by default in order to help you during the installation, you can change it in the index.php file.
Now visit the web site and you will see the working page.
The pre-packaged distribution contains an .htaccess pre-build file that uses mod_rewrite.
mod_rewrite is optional but strongly suggested.
Edit your site configuration file and add the following lines to your “location / {...}” section:
location / {
# ...
if (!-f $request_filename) {
rewrite ^.*$ /index.php last;
break;
}
if (!-d $request_filename) {
rewrite ^.*$ /index.php last;
break;
}
# ...
}
The rewrite feature is optional but strongly suggested.
Here it is explained the reccommended way to do the manual installation, but Phraw is so flexible that you can change this method in one that you prefer.
The steps are:
# Creation of the directory structure # Installation of the libraries (Phraw included) # Creation of the web site starting from a brand new index.php file
Open the web site directory an create this suggested structure:
lib/
static/
media/
resources/
cached/
compiled/
templates/
The lib directory contains the libraries, like Phraw.
The static directory contains the files that compose the HTML front end like images, CSS, JavaScript and so on.
The media directory will contains the user files.
The resources directory contains the files that compose the web site. Inside there are: cached for automatic cached templates, compiled for automatic compiled templates, and templates for source templates.
In order to increase the security it is recommended to create and put the following .htaccess file in lib and resources directories:
<Files *>
Order deny,allow
Deny from all
</Files>
Smarty is not necessary, but it is used in this documentation so it is suggested to install it.
Download Phraw and Smarty. Extract the two packages in the lib directory.
For a cleaner setup it is suggested to copy only the libs directory in the Smarty package and rename it smarty. For Phraw copy only the phraw sub-directory. The result should look like:
lib/
phraw
extensions/
phraw.php
smarty
plugins/
sysplugins/
debug.tpl
Smarty.class.php
static/
media/
resources/
cached/
compiled/
templates/
Phraw is now ready to use. In order to print something you should create and edit the index.php file. Continue reading the next chapter quickstart for more informations.