INSTALLATION OF SMARTY ON A HOSTING ACCOUNT.
In today's tutorial I am gonna explain on how to install smarty in your hosting account. Before I start with the explaination, let us remind ourselves of what smarty is. Well, smarty can be defined as php template engine but more accurately we can define smarty as "Template/Presentation Framework." That is, it provides the programmer and template designer with a wealth of tools to automate tasks commonly dealt with at the presentation layer of an application. It is Presentation Framework because Smarty is not a simple tag-replacing template engine. Although it can be used for such a simple purpose, its focus is on quick and painless development and deployment of your application, while maintaining high-performance, scalability, security and future growth. For more information about Smarty please visit http://smarty.net/rightforme.php
Advantages of using smarty
1. Designers can't break application code. They can mess with the templates all they want, but the code stays intact. The code will be tighter, more secure and easier to maintain.

2. Errors in the templates are confined to the Smartys error handling routines, making them as simple and intuitive as possible for the designer.

3. With presentation on its own layer, designers can modify or completely redesign it from scratch, all without intervention from the programmer.

4. Programmers aren't messing with templates. They can go about maintaining the application code, changing the way content is acquired, making new business rules, etc. without disturbing the presentation layer.

5. Templates are a close representation of what the final output will be, which is an intuitive approach. Designers don't care how the content got to the template. If you have extraneous data in the template such as an SQL statement, this opens the risk of breaking application code by accidental deletion or alteration by the designer.

6. You are not opening your server to the execution of arbitrary PHP code. Smarty has many security features built in so designers won't breach security, whether intentional or accidental. They can only do what they are confined to in the templates.

Now let us see how you can install smarty on your hosting account. First download smarty from www.smarty.net, Extract a folder named libs from the smarty folder you downloaded, and copy it into your home directory,exanple /home/username/public_html.
Replace username with your exact username.
Create a folder named smarty in your root directory.Create and copy into smarty(the folder you just created) the following four folders. 1.templates_c
2.templates
3.configs
4.cache
Stoer all your template files in the second folder(templates).
To demonstrate how this is gonna work let us see an example below. Create the the following php file named rusumo.php
<?php
//getting information
$name = "Msafiri";
$surname ="Rusumo";
$city = "Las Vegas";
$phone = "Not available";
$country = "USA";
//Calling smarty template engine.
// put full path to Smarty.class.php
require('/home/username/public_html/libs/Smarty.class.php');
$smarty = new Smarty();
//$smarty->use_sub_dirs = true;
//$smarty->debugging = false;
$smarty->template_dir = '/home/username/public_html/smarty/templates';
$smarty->compile_dir = '/home/username/public_html/smarty/templates_c';
$smarty->cache_dir = '/home/username/public_html/smarty/cache';
$smarty->config_dir = '/home/username/public_html/smarty/configs';
$smarty->assign('name',$name);
$smarty->assign('surname',$surname);
$smarty->assign('city',$city);
$smarty->assign('phone',$phone);
$smarty->assign('country',$country);
$smarty->display('rusumo.tpl');
? >
Now create the following template file name rusumo.tpl,copy this file into the folder named templates (found under the folder named smarty).
<html>
   <head>
      <title> Installation of smarty on hosting account</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
   <body>
      <table>
         <tr>
               <td>Name:</td><td></td>
         </tr>
         <tr>
               <td>Surname:</td><td></td>
         </tr>
         <tr>
                <td>City:</td><td></td>
         </tr>
         <tr>
               <td>Phone:</td><td></td>
         </tr>
         <tr>
               <td>Country:</td><td></td>
         </tr>
      </table>
   </body>
</html>

Now you can test you codes. If you get any error don`t hesitate to contact me, I am always available to help you free of charge. To contact me just click on contacts and send me a message.

Comments()

Leave a reply »

 
moms016
Nov Thu 19 2009,18:52:58
 

Ni hivi hizi kodi unaziandika kwa mkono ama ni programu maalumu imeshaandaliwa? mbona nyingi sana..

 

moms016 hizi kodi unaandika kwa mkono wala sio ngumu,pengine kwa vile hujawahi kuandika ndio maana unaziona nyingi,lakini ni rahisi sana kama utaamua kujifunza.

Gazza
Nov Fri 27 2009,13:35:03
 

Ebwana Msafiri sana TU mzee. nimekusoma mtu wangu

 

sema msafiri kafiri,nimekukubali kijana.mbona page ya muziki inaleta rabsha?ama mambo bado?

moms016
Dec Wed 23 2009,15:14:43
 

Yap nimejaribu na inaonekana km ulivyosema ila zinahitaji majaribio mengi. Anyway asante kwa majibu.

 

MOMOS016 kwanza unajua computer mzee au mwenzangu mimi najua kuwasha na kuzima ndiyo maana unaona mimi siulizi yangu macho tu, Mzee rusumo unatisha unaoneka unaijua Tarakilishi (computer) kama baskel

imu
Jan Sat 02 2010,00:42:08
 

Kaka i have gone through ur web... its nice.. but most of the people like the web to be graphically..and that is how u gona gat more views on your web..jus try to make it attractive ..some animation Im sure u know how is gona look like...Man really najisikia wivu mzee.. my wish its was one day to create my own website without any one hand..i stard.. VB..SQL..MY SQL..ORAQLE..LINUX..ila kaka mpaka sasa niko patupu mzee.. and wot i beliave now.. i cant do anything unajua ukiwa na majukumu na wish kurudu college and stard that stuff ila wapi mzee.. mda umeisha .. Any way how is turky is that poor country ??? i have seen so many turkish they are comming in my country to work..

tumaini geofrey temu
 

THANS MAN FOR BEING A THINK TANK OF OUR NATION WE WILL SUPPORT YOUFOREVEER

Leave a Reply

Your name
 
Email
 
Comment