| Current Path : /var/www/html/mmishra/indem/mailscript/mcell/ |
| Current File : /var/www/html/mmishra/indem/mailscript/mcell/quick_start.html |
<html>
<head>
<title>Smarty : Why Use Smarty</title>
<link rel="stylesheet" href="/style.css" />
<link rel="shortcut icon" href="/gifs/favicon.ico" />
</head>
<body
topmargin="0" leftmargin="0"
marginheight="0" marginwidth="0"
bgcolor="#ffffff"
text="#000000"
link="#3b404c"
alink="#767f97"
vlink="#3b404c"
><a name="TOP"></a>
<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
<tr bgcolor="#f0c040">
<td align="left" rowspan="2">
<a href="/"><img src="/gifs/smarty-logo-orange.gif" border="0" width="250" height="64" ALT="smarty template engine" vspace="2" hspace="2"></a><br>
</td>
<td align="right" valign="top" nowrap>
<font color="#786020" class="date"><b>
Thursday, May 26, 2005 </b> <br>
</font>
</td>
</tr>
<tr bgcolor="#f0c040">
<td align="right" valign="bottom" nowrap>
<a href="/download.php" class="menuBlack">download</a> | <a href="/docs.php" class="menuBlack">documentation</a> | <a href="http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions" class="menuBlack">faq</a> | <a href="http://www.phpinsider.com/smarty-forum/" class="menuBlack">forum</a> | <a href="/resources.php?category=7" class="menuBlack">mailing lists</a> | <a href="/changelog.php" class="menuBlack">changelog</a> | <a href="/contribs.php" class="menuBlack">contribs</a> <br>
<img src="/gifs/spacer.gif" width="2" height="2" border="0" alt="" ><br>
</td>
</tr>
<tr bgcolor="#000000"><td colspan="2"><img src="/gifs/spacer.gif" width="1" height="1" border="0" alt="" ><br></td></tr>
<tr bgcolor="#9b410e">
<form method="POST" action="/search.php">
<td align="right" valign="top" colspan="2" nowrap><font color="#ffffff">
<small>search for</small>
<INPUT CLASS="small" TYPE="text" NAME="pattern" VALUE="" SIZE="30">
<small>in the</small>
<SELECT NAME="show" CLASS="small">
<OPTION VALUE="manual-en">English manual
<OPTION VALUE="manual-de">German manual
<OPTION VALUE="manual-fr">French manual
<OPTION VALUE="manual-pt_BR">Portuguese manual
<OPTION VALUE="smarty-general-list">general mailing list
<OPTION VALUE="smarty-dev-list">development mailing list
</SELECT>
<input type="image" src="/gifs/small_submit_white.gif" border="0" width="11" height="11" ALT="search" align="bottom"> <br>
</font></td>
</form>
</tr>
<tr bgcolor="#000000"><td colspan="2"><img src="/gifs/spacer.gif" width="1" height="1" border="0" alt="" ><br></td></tr>
</table>
<table cellpadding="0" cellspacing="0">
<tr valign="top">
<td bgcolor="#f0ead8">
<table width="170" cellpadding="4" cellspacing="0">
<tr valign="top">
<td class="sidebar"><b>Get Smarty</b>
<p>
<a href="/download.php">Download!</a><br />
<a href="/contribs.php">Contributed Code</a>
</p>
<b>What is Smarty?</b>
<p>
<a href="/rightforme.php">Is Smarty right for me?</a><br />
<a href="/whyuse.php">Why use it?</a><br />
<a href="/crashcourse.php">Crash Course</a><br />
<a href="/manual/en/preface.php">Preface from docs</a><br />
<a href="/manual/en/what.is.smarty.php">Summary from docs</a><br />
<a href="http://www.phpinsider.com/smarty-forum/viewforum.php?f=12">Testimonials</a>
</p>
<b>Get Help!</b>
<p>
<a href="/quick_start.php">Quick Install</a><br />
<a href="/docs.php">Documentation</a><br />
<a href="/sampleapp/sampleapp_p1.php">Sample Application</a><br />
<a href="http://www.phpinsider.com/smarty-forum/">Discussion Forums</a><br />
<a href="irc://irc.freenode.net/smarty">Internet Relay Chat</a><br />
<a href="/resources.php?category=7">Mailing Lists</a><br />
<a href="http://smarty.incutio.com/">Smarty Wiki</a><br />
<a href="http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions">FAQ (from wiki)</a><br />
<a href="/resources.php">Other Resources</a>
</p>
<p>
<b>Vote for Smarty!</b>
</p>
<p>
Feel free to put in your rating or review of Smarty
at <a href="http://www.hotscripts.com/Detailed/8817.html">HotScripts.com</a>
</p>
<p>
<b>Smarty Icon</b>
</p>
<p>
You may only use the Smarty logo according to the <a href="/copyright.php">trademark notice</a>
</p>
<img src="/gifs/smarty_icon.gif" border=0 width="88" height="31">
<p>
<b>Tell us about it!</b>
</p>
<p>
Got some news for the front page? New articles, weblog discussions, public
talks, etc? <a href="mailto:smarty-webmaster@php.net?subject=smarty+news">Let us
know!</a>
</td>
</tr>
</table>
</td>
<td bgcolor="#f0ead8" background="/gifs/checkerboard-orange.gif" width="2">
<img src="/gifs/spacer.gif" width="2" height="2" border="0" alt="" ><br></td>
<td>
<table width="600" cellpadding="10" cellspacing="0">
<tr>
<td valign="top">
<PRE>
This is a simple guide to get Smarty setup and running quickly. The online
documentation includes a very thorough explanation of a Smarty installation.
This guide is meant to be a quick and painless way of getting Smarty working,
and nothing more. The guide assumes you are familiar with the UNIX system
environment. Windows users will need to make adjustments where necessary.
INSTALL SMARTY LIBRARY FILES
Copy the Smarty library files to your system. In our example, we place them in
/usr/local/lib/php/Smarty/
$> gtar -ztvf Smarty-2.6.7.tar.gz
$> mkdir /usr/local/lib/php/Smarty
$> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
You should now have the following file structure:
/usr/local/lib/php/Smarty/
Config_File.class.php
debug.tpl
internals/
plugins/
Smarty.class.php
Smarty_Compiler.class.php
SETUP SMARTY DIRECTORIES
You will need four directories setup for Smarty to work. These files are for
templates, compiled templates, cached templates and config files. You may or
may not use caching or config files, but it is a good idea to set them up
anyways. It is also recommended to place them outside of the web server
document root. The web server PHP user will need write access to the cache and
compile directories as well.
In our example, the document root is /web/www.domain.com/docs and the
web server username is "nobody". We will keep our Smarty files under
/web/www.domain.com/smarty
$> cd /web/www.domain.com
$> mkdir smarty
$> mkdir smarty/templates
$> mkdir smarty/templates_c
$> mkdir smarty/cache
$> mkdir smarty/configs
$> chown nobody:nobody smarty/templates_c
$> chown nobody:nobody smarty/cache
$> chmod 775 smarty/templates_c
$> chmod 775 smarty/cache
SETUP SMARTY PHP SCRIPTS
Now we setup our application in the document root:
$> cd /web/www.domain.com/docs
$> mkdir myapp
$> cd myapp
$> vi index.php
Edit the index.php file to look like the following:
<?php
// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = '/web/www.domain.com/smarty/templates';
$smarty->compile_dir = '/web/www.domain.com/smarty/templates_c';
$smarty->cache_dir = '/web/www.domain.com/smarty/cache';
$smarty->config_dir = '/web/www.domain.com/smarty/configs';
$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');
?>
SETUP SMARTY TEMPLATE
$> vi /web/www.domain.com/smarty/templates/index.tpl
Edit the index.tpl file with the following:
<html>
<head>
<title>Smarty</title>
</head>
<body>
Hello, {$name}!
</body>
</html>
Now go to your new application through the web browser,
http://www.domain.com/myapp/index.php in our example. You should see the text
"Hello Ned!" in your browser.
Once you get this far, you can continue on to the Smarty Crash Course to learn
a few more simple things, or on to the documentation to learn it all.
</PRE>
<br> </td>
</tr>
</table>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr bgcolor="#000000"><td><img src="/gifs/spacer.gif" width="1" height="1" border="0" alt="" ><br></td></tr>
<tr bgcolor="#9b410e">
<td align="right" valign="bottom"><a href="/source.php?url=/quick_start.php" class="menuWhite">show source</a><font color="#ffffff"> | </font><a href="/credits.php" class="menuWhite">credits</a> <br>
</td>
</tr>
<tr bgcolor="#000000"><td><img src="/gifs/spacer.gif" width="1" height="1" border="0" alt="" ><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tr valign="top" bgcolor="#f0c040">
<td><small>
<a href="http://www.php.net/"><img src="/gifs/php-logo.gif" border="0" width="69" height="36" ALT="PHP" align="left"></a> <a href="/copyright.php"> Website Copyright © 2002, 2003 The PHP Group</a><br>
<a href="/copyright.php"> Smarty Copyright © 2002-2005 New Digital Group, Inc.</a><br>
All rights reserved.<BR>
</small>
</td>
<td align="right"><small>
Last updated: Thu Feb 3 21:47:36 2005 CET<BR>
</small><br>
</td>
</tr>
</table>
</body>
</html>