Greytree

TamWiki

For a mouse who is a packrat

Technology » Installing Smarty
how to install Smarty

Summary:this is what goes at the top of the site

(redirected from Main.InstallingSmarty)

Next: Using Smarty >>

Up: ^Smarty^

Installing Smarty is really quite simple on certain distributions.

Debian/Ubuntu and derivatives

Simple as running apt-get:

# apt-get install smarty

and Bob's your uncle.

The above command puts the smarty installation in one of the standard php library include paths, so you can include it in your PHP code with:

require_once('smarty/Smarty.class.php');

OS/X

It's a little more difficult to do on OS/X, since there are a few different possibilities, depending on how and where you've installed PHP.

You can always install Smarty directly yourself, which is simply a matter of downloading the files from http://www.smarty.net/download -- you probably want the latest stable release.

Unpack the .zip file someplace temporarily (I often just do this in my ~/Downloads directory). Then, move the files from the libs directory to an appropriate place on your PHP include path. You can place them directly in a directory on the include path, or you can do like the Debian install does and put them in a sub-directory called "smarty".

If you've installed the Smarty libraries directly on the include path, then the line to include it in your application is:

require_once('Smarty.class.php');

If you've installed Smarty in a sub-directory on your include path, then:

require_once('smarty/Smarty.class.php');

If you've installed Smarty someplace else entirely, you will need to do 2 things:

  1. Define the constant SMARTY_DIR to point to the absolute path where Smarty lives.
  2. Use the SMARTY_DIR define in your require_once directive:
define('SMARTY_DIR','/path/to/smarty/library/'); // SMARTY_DIR **MUST** include the trailing slash
require_once(SMARTY_DIR.'Smarty.class.php');

On to Configuring Smarty >>



Tags: Categories: Articles

Recent Changes | Printable View | Page History | Edit Page
Page last modified on April 13, 2012, at 01:52 PM by tamara