PHP USING SMARTY
Till now i developed most of my projects using asp.net. Just last month only
i learned PHP (PHP: Hypertext Preprocessor) is a programming language
designed for producing dynamic Web pages. PHP is an open source language and
considered to be free software by the Free Software Foundation. At this time,
i discovered Smarty and have been using it in my projects.
Now the question is why do we use Smarty and what is the purpose of using
it...???
Traditionally, when you make a web application using php, html and php scripts
are mixed in one file.
More often than not, a programmer finishes a complete project, and someone
suggests that the font and background colors chosenhe/his choose don't match
with their requirement. The programmer would then hasve to search through
dozens of php files and alter the HTML that was embedded within simply to
change the appearance of the web site and change all other properties. Editing
the php files greatly increases the chance of generatinge new errors or bugs.
It will much easier when you separate your HTML from your PHP code and will
also make it much easier to reuse your PHP code down the road in other projects.
So the above solution can be applied by using Smarty technology as, it allows
you to change the appearance of your web site by changing an HTML template
file. It also allows you to do simple if statements, dynamic repeating blocks,
and variable substitution.
The basic use of Smarty is for separation of business logic and presentation
logic, generates web content by the placement of special Smarty tags within
a document. So it allows the presentation of a web page to change separately
from the back-end, thus allowing applications to be developed in a more organized
fashion. Using this development model, designers are hidden from the back-end
coding and PHP programmers are hidden from the presentation coding.
Tasks of both designer and programmer are is as follows :
Programmer's Tasks:
-> Fetching data from database by firing simple queries to it.
-> Manipulate or validate the data by performing business logic on it.
-> The best thing is that we can change the data access method like from
MySql to another without interfering with designer's work.
Designer's Task:
->Creating HTML pages without affecting php scripts , only concerned is
with placing content elements on the right place where the programmer has
agreed to provide.
Some of the attractive features of using smarty areis as follows :
1) Fast : Smarty is extremely fast by doing Template
Compiling, means it reads the templates, creates php scripts and include the
php files which is finally compiled by php engine..The best thing is that
the templates are parsed only once by smarty if it is not modified again..
this results in to fast compilation and better performance.
2) Catching : Smarty has built-in catching of your template
outputs. It catches the output of the template contents and thus saves the
overhead of retrieving the data from data source.
3) Variable Modifiers : Smarty provides variable modifiers
in order to modify the contents of a variable like converting string to uppercase
or lowercase or truncating etc things like that very easily
4) Template Function : Smarty provides some builtin and custom
functions like looping function like if statements or for loops etc.Or just
write a simple one line code which will generate a radiobuttons or calendar
or other form controls which make things faster and more simple.r.
Smarty is a great tool for both designers and developers. By using Smarty
you can reduce the site development and maintenance times. If you are a developer
you no longer need to mix PHP code with HTML code. Just take care of business
logic and leave the HTML to the designer
Now the matter of debugging the smarty php scripts. Nusphere provides
PHP Editor for editing and debugging..Ii'ss latest verison is PhpEd version
4.6.2 has been released with full support for PHP 5.2.
The definitive resource for learning Smarty is smarty.php.net,where
you will get all the stuffs related to Smarty.
I'm still learning about it, so I'm in no way an expert, but if you have
any questions, please feel free to ask.
Thank You,
Author:
By Nishant Bharathan
Nishant Bharathan is working as a Jr. Programmer at Semaphore Infotech Pvt. Ltd, India. He has 8 months Experience in .net programming. You can contact on email: nishant@semaphore-software.com.
Related Tags: india, windows mobile, business process outsourcing, software testing, offshore software development, consulting services, offshore outsourcing, data entry india, offshore outsourcing india, outsourcing software development, application development, offshore software development company india, it outsourcing company, website design and development, java development, net application development, vb .net application development, asp .net development, database application, system integration, search engine optimization and promotion
Your Article Search Directory : Find in Articles
Recent articles in this category:
- Improper Way Of Marketing Reflects Poorly On A Company.
New business, product or service everything requires visibility, awareness in order to come into the - Replacing Paper Prints With Online Versions
Nowadays saving out on resources and being additionally informative are both aspects that are in. In - Stop Smoking Effectively
If I told you of a way that you could stop smoking harmful tobacco would you believe it? Most people - What Is Runtime Error 182? And How To Fix It
Are you finding an effective way to fix runtime error 182? Do you think fixing runtime error 182 is - Do You Know How To Fix Runtime Error 87 In Minutes?
Are you finding an effective way to fix runtime error 87? Do you think fixing runtime error 87 is to - Knowledge About Avi, Avi Player, Avi Converter On Mac
Knowledge about AVI, AVI player, AVI Converter on MacWhat is an AVI?AVI, an acronym for Audio Video - Buy Your Highly Successful Email Survey Software Today
Email Survey Software- Boost Your Business and Increase ProfitsAn email survey software could be one - Xrm - The Anything Relationship Management Solution
I recently attended the Microsoft Dynamics West Region FY11 Sales Planning Retreat. This year's meet - What Are The Benefits Of Working With Electronic Medical Records
Recording medical information is a vital part of health care services. These records are necessary f - Basic Factor To Make Website Business Oriented
Internet is home for millions of websites. The online business is becoming more and more competitive
Most viewed articles in this category:
- Parental Control Software
Parental control software is software that can help parents protect their children when they are onl - Digital Asset Management Software
Managing and organizing your organization's documents is a critical component to your business's suc - AdobeRGB vs. sRGB
Understanding color spaces I'll try to explain it very simplified, but understandable for everyone - Confessions of a Prankster
I wanted to get a jump on April Fool's Day, partially because of the long, cold winter blues, and pa - Malicious Thoughts About The Spyware Ills Of My PC
Who would think I was capable of such revengeful thoughts about the parties responsible for inflicti - Recover File and Recover Deleted File Tools
Data recovery software is a very effective way of retrieving data from a worn or damaged hard disk d - Life without Windows
Ubuntu, a user-friendly version of Linux, has been running so nicely on my home PC that I decided to - What Benefit Does an Online Software Download Site Offer You?
Are you having a problem that where you find a good softeware when you consider to have a try or wan - Maintaining A Website
There was an era when people were talking about how to create a website using html coding or some ea - Benefits Of Proper Time Tracking
Have you ever written down time when you have started and finished your work? Maybe you have had mul