Monday, May 21, 2007

How to start developing a simple application using PHP and Smarty

Its very easy to develop an application using Smarty and Php on Windows environment, how I am going to describe.

Step 1: download the smarty package from http://smarty.php.net/download.php


Step 2: Unzip the content.

Step 3: Rename it to your application name.

Step 4: Copy and paste it to your server's root folder.

Step 5: Create "templates_c" folder inside your application folder.

Step 6: Create setup.php inside configs folder. paste following code.

Smarty();

$this->template_dir = $path.'templates';
$this->compile_dir = $path.'templates_c';
$this->cache_dir = $path.'cache';
$this->config_dir = $path.'configs';

$this->caching = false;
}
}

?>



Step 7: Create a page named index.php write following code

display("main.tpl");
?>


Step 8: In side templates folder create a file named "main.tpl" write here HTML codes.
like
<h1>Welcome</h1>

Step 9: now run the application.

No comments: