tags:

views:

97

answers:

1

I m somewhat okay with why & where Smarty is used and also the upper hand it has over traditional PHP... but please tell me how is the separation of the application and the presentation parts needed as the definition itself says this about Smarty.. Please suggest some web sites where i can get some details in simple literature.......

+3  A: 

Most programming models try at least to separate “business logic” (application logic) and “presentation”. Actually, many architectures define even more separate “layers” or “tiers”.

Business logic is what your program is about, what you are trying to achieve. For example, if you are writing a guestbook application, handling users and comments is part of the business logic.

Presentation means presenting the data managed by the business logic to your users by some kind of user interface. When using Smarty, this will usually mean creating HTML.

Separating these layers has many advantages:

  • You can change the look of your page (redesign) without having to touch your business logic.
  • You can provide different views on your data: A printer-friendly version, a version for handicapped people, different color themes, different output formats and so on.
  • If you are working in a team, UI experts / designers can design the user interface and programmers can concentrate on programming.

For more details, look for terms like “MVC” (Model-View-Controller) or “Multitier architecture”.

Especially useful might be the description of the “three-tier architecture” in the latter Wikipedia article. In addition to presentation and application tiers, it defines the “data tier” that is responsible for storing and retrieving persistent data.

Ferdinand Beyer
thanks .. now it seems some what okay with me..still some doubts exist...
Sachindra