Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

Use Cases and Work Flow

Use cases and work flow are a large component in deciding if Smarty is a good fit for your project. We'll outline a few here.

Use Case 1: Enterprise level 3rd party access

Let's say we host a large number of websites for college newspapers. Web designers from each college (typically a new batch of students every semester) have a hand in editing the look and feel of their website. They do this by transferring the HTML, images, etc. to and from the website server. Exposing PHP would easily allow malicious code (intentional or not) in the templates, putting server reliability and data at risk. This is exactly the business case that Smarty was originally designed to solve. Smarty sandboxes the designers to just the features of the template language. Users can maintain templates regardless of their knowledge of PHP.

Use Case 2: Templates in a CMS/Wiki

In the example of a Content Management System or Wiki where completely inexperienced users are changing the website templates and pages, Smarty tags are easier to understand and customize than any PHP statement could ever be.

Use Case 3: Websites with one (or more) PHP developers and one (or more) web designers

This use case is another common one for Smarty. Web designers, especially those unfamiliar with PHP, will typically welcome a tag-based syntax for HTML management. They find them easier to read, understand and maintain.

Use Case 4: One person is the developer and the web designer

PHP developers are commonly indifferent about mixing PHP with HTML. They may not see a benefit in a tag-based syntax. Unless there is a specific business case for Smarty, PHP mixed with HTML is the common choice here.

Use Case 5: A small project where ongoing template maintenance is minimal

If the web site templates stay pretty much static once the site is developed, especially if the number of templates are minimal and the PHP developer is the person maintaining them, Smarty is not a common fit for this type of project. The exception would be if the developer has a preference of tag-based templates, or if there is a specific business case for Smarty.

The application code base

The application code base will also play a large role in the choice of using Smarty. You may have a custom framework you are using, or you might use a 3rd party development platform such as Zend, PHPCake or Code Igniter. Ask yourself: how much overlap is there with Smarty and the code base? Smarty has a wealth of features to consider that may not be readily available in other frameworks: flexible and granular caching, template inheritance and separation from PHP to name a few.

How your business works

The development process plays a large role with templating requirements. For very small businesses with small projects, the person with many hats may work well for them. But as business grows and more projects are brought on board, at some point the process needs to be balanced to maintain efficiency. Who writes PHP code? Who writes HTML/JS/CSS? Who makes logos and designs layout? These are commonly three different areas of expertise, and it usually works best to separate them. The "backend" developer is the person(s) versed in Linux, Apache, MySQL and PHP (also called LAMP/WAMP/MAMP). The "frontend" developer is the person(s) fluent with HTML, CSS, Javascript, web browser compatibility, HTML standards compliance and accessibility compliance. The graphics designer is the person(s) familiar with logo design and web page layout, and specific software packages such as Adobe Photoshop and Adobe Illustrator. There are obviously overlaps, but this is the basic role breakdown. Trying to mix any of these two roles into one person will likely lead to an accordion affect in your work flow when things get busy. Once roles are established, your work flow, business requirements, developer preferences and PHP frameworks will lead you to determine if Smarty is a good fit.