Ransford Okpoti's Blog

1 February, 2008

Smarty Overview

Filed under: Smarty Templating — Tags: , — ranskills @ 5:30 pm

Smarty is one of the most popular PHP templating engines. There are many other templating engines, based on similar principles, such as

  • PHPTemplate
  • PHPTAL (TAL Template Attribute Language), phptal.motion-twin.com/
  • Savant, http://phpsavant.com/
  • FastTemplate
  • PHPlib

Irrespective of the templating engine that one uses, one of the design goals is the separation of business logic from the presentation logic. A point of caution, you can still use Smarty, the wrong way, without the clear separation of the business and presentation logic since Smarty does not enforce the separation of the 2 logics.

Business logic basically has to deal with how you solve the problem at hand, such as the computation of an employee’s monthly salary using the various parameters required in a typical payroll application.

Presentation logic, as the name suggests, deals with the logic pertaining to the presentation of data/content only. Examples of presentation logic are: iterating through an array of data to be displayed, picking the first X number of characters to display such as displaying a news or an article summary, alternating row colours of tables, etc.

Simply put, a templating engine replaces placeholders with values you specify.
In a real world web development project, there are going to be 2 main teams working on the project namely:
The developers/programmers who uses the full power of the programming language to achieve the requirements of the system such as accessing data from a database or a web service, validating and process the data, and persisting or presenting the processed data if required.
Designer or user interface (UI) team which builds the interface the users of the application would interact with using xHTML and it’s various controls or any appropriate UI technology suitable for the project at hand without affecting the developers codes.

SMARTY INSTALLATION

Advertisements

4 Comments »

  1. I really really want to take note of this specific posting, “Smarty Overview Ransford Okpoti’s Blog” on my webpage. Do you mind in the event that Ido it? Thanks ,Allie

    Comment by http://tinyurl.com/encomaggs20109 — 5 February, 2013 @ 12:38 pm

    • Hi There,
      Please do feel free to use this post.

      Thanks.

      Comment by ranskills — 6 February, 2013 @ 7:57 pm

  2. Hello there, just became alert to your blog through Google, and found
    that it is really informative. I will appreciate if you continue this in future. A lot of people will be benefited from your writing. Cheers!

    Comment by Aretha — 1 March, 2013 @ 9:56 am

  3. I seldom create responses, however i did some searching and wound up here Smarty
    Overview | Ransford Okpoti’s Blog. And I actually do have some questions for you if you don’t mind.

    Is it simply me or does it look as if like some of
    these remarks look like they are written by brain dead
    folks? 😛 And, if you are posting at additional online sites, I’d like to keep
    up with everything fresh you have to post. Would you make a list of every one of all your communal pages like your Facebook page, twitter feed,
    or linkedin profile?

    Comment by ข้อสอบข้อเขียนbec — 19 November, 2014 @ 3:45 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: