search engine optimization   Programming blog
        SEO        Link Building        Services        Genie Magic        Web Design        Contact Us        SEO Tools
 
   
Smarty for Programmers, Wednesday, May 7, 2008
   
 

The advantage for programmers is that they write the code in a PHP file without having to combine the instructions with HTML. Also, if the designer changes the layout of a page the programmer doesn't have to change the code to suit the new layout since the functionalities won't change. You perform your work in your files, assign to the templates all the values needed to print on the site and go out for a beer.

The PHP file you need to include the Smarty class
require 'Smarty.class.php'. After that you instantiate the smarty with $smarty = new Smarty.

To assign a variable to the template you need to
$smarty->assign('UserName', 'Jeff Adams'). After everything is finished you call the method and to display the template $smarty->display('index.tpl').

A sample code like this (index.php) :


<php
require 'Smarty.class.php';

$smarty = new Smarty;
$smarty->assign('Username', 'Jeff Adams');
$smarty->display('index.tpl');
?>


The template (index.tpl) like this:

<html>
<body>
Welcome {$Username}
<body>
</html>


Also create an array in PHP an pass it to the template:

$tmplate = array ( 'UID'=> '10', &'Name' => 'Jeff Adams', 'Address'=>'Home address');
$smarty->assign('info', $tmplate);

                                Earthlink Netscape Netvouz RawSugar Shadows Sphinn StumbleUpon Yahoo MyWeb

 
   
 

posted by candy @ 12:25 AM permanent link   |

Post a Comment

|

 

0 Comments:

Home

 

Categories
 

 
Archives
 
Previous posts
 
 
PageRank 10 sites
Search Engine Optimization SEO Blog
Search Engine
Optimization SEO News
SEO Copywriting Blog
Web Design Blog
Link Building Blog
Pay Per Click (PPC) Blog
Programming Blog
Search EngineGenie Blog
Lara's Personnal Blog
Search Engine
Optimization SEO Forum
SEO Comics
Webmaster & Search Events
 
search engine optimization
search engine marketing
SEO consulting
SEO plans
SEO services USA
search engine optimization SEO forum
SEO comics
Webmaster & Search Events
SEO Faqs
link popularity
strategies of link building
link building services
link cost
link request quote
link building blog
search engine genie company
our team
our celebrations
our experience
SEO
why us

web design
web designing services
dynamic website
web design and marketing
simple e-commerce website
complex e-commerce website
search engine friendly site
web design blog
web design
link building
internet marketing
ecommerce implementation
pay per click services
shopping feeds optimization
shopping cart customization
product development
online forms & database integration
programming services
PHP programming services
programming services Java,J2EE
.NET application development programming services
business process outsourcing
offshore outsourcing
Google Products(froogle feeds)
search engine optimization articles
google articles
yahoo articles
miscellenous articles
search engine optimization SEO blog
search engine optimization SEO news
SEO copywriting blog
web design blog
link building blog
pay per click (PPC) blog
programming blog
lara personnal blog
Search Engine Genie Blog
Google Tools
Yahoo Tools
MSN Tools
Comparison Tools
Link Popularity Tools
Search Engines Tools
Site Tools
Keyword tools

contact us
support
our guarantee
events