TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 09-21-2007, 07:04 PM   #1 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default How to install smarty

Smarty is a known template engine. It has expanded library of functions to help you remove your template from the code .

To use Smarty as a standalone tool and avoid installing it server-side. Follow the steps below:
  1. Download the latest stable Smarty release http://smarty.php.net/download.php
  2. Create templates_c, templates and configs folder in your PHP project root directory
  3. Copy all the files and folders from the libs folder which came with Smarty package
  4. Paste the files and folders to the root directory of your PHP project where templates, templates_c and configs folder resides.
  5. Voila, you're done!

Now to test if Smarty is working.

First, create index.php and save it with the code below:

PHP Code:
<?php

// load Smarty library
require('Smarty.class.php');

$smarty = new Smarty;

$smarty->assign('name','fish boy!');

$smarty->display('index.tpl');

?>
Then, create index.tpl in the templates folder:

HTML Code:
<html>
<body>
 Hello, {$name}!
</body>
</html>
If it renders Hello fish boy then Smarty is successfully connected. :)
Haris is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:35 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design