Share on Facebook Share on Twitter Email
Answers.com

smarty

 
Dictionary: smart·y   (smär') pronunciation
 
n. Informal., pl. -ies.
  1. A smart aleck.
  2. A quick-witted person.

Search unanswered questions...
Enter a word or phrase...
All Community Q&A Reference topics
 

An earlier device marketed by Fischer International Systems Corporation, Naples, FL www.fisc.com) that used a standard 3.5" floppy drive to read smart cards. The smart card was inserted into Smarty, which resembled a floppy disk. Circuits within Smarty emulated the magnetic field produced by a rotating floppy disk so that the drive could read the smart card.

A Smart Card or a Floppy?
This innovative device let every PC in the world read a smart card. (Image courtesy of Fischer International Systems Corporation.)

Download Computer Desktop Encyclopedia to your iPhone/iTouch

 
Food and Nutrition: Smarties
Top

Trade name; pellets of chocolate covered with coloured hard candy, introduced by Rowntree & Co., 1937.

 
Thesaurus: smarty
Top

noun

    One who is obnoxiously self-assertive and arrogant: malapert, witling. Informal know-it-all, saucebox, smart aleck, smarty-pants, wisenheimer. Slang wiseacre, wisecracker, wise guy. See good/bad.

 
Wikipedia: Smarty
Top
Smarty Templates
Image:Smarty-logo.png
Developer(s) Monte Ohrt, Messju Mohr
Stable release 2.6.25 / 2009-05-23; 24 days ago
Preview release 3.0 Alpha / 2008-10-17; 7 months ago
Type Template Engine
License LGPL
Website www.smarty.net

Smarty is a web template system written in PHP. Smarty is primarily promoted as a tool for separation of concerns, which is a common design strategy for certain kinds of applications.[1][2]

Smarty generates web content by the placement of special Smarty tags within a document. These tags are processed and substituted with other code.

Tags are directives for Smarty that are enclosed by template delimiters. These directives can be variables, denoted by a dollar sign ($), functions, logical or loop statements. Smarty allows PHP programmers to define custom functions that can be accessed using Smarty tags.

Smarty is intended to simplify compartmentalization, allowing the presentation of a web page to change separately from the back-end. Ideally, this eases the costs and efforts associated with software maintenance. Under successful application of this development strategy, designers are shielded from the back-end coding, and PHP programmers are shielded from the presentation coding.

Contents

Features

Smarty supports several high-level template programming features, including:

  • Control flow statements, foreach
  • if, elseif, else statements
  • variable modifiers - For example {$variable|nl2br}
  • functions - For example {html_select_date start_year='-5' end_year='+5'}
  • output filters
  • possiblity to create own modifiers / functions / output filters
  • advanced caching of pages

along with other features. There are other template engines that also support these features. Smarty templates are often incorporated into existing PHP web applications to some extent. More often it is used where a web application or a website has a theme system built into it, where the templates can be changed from theme to theme.

Code example

Since Smarty separates PHP from HTML, you have two files. One contains the presentation code, including Smarty variables:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
<head>
   <title>{$title_text|escape}</title>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
 
<body> {* This is a little comment that won't be visible in the HTML source *}
 
{$body_html}
 
</body><!-- this is a little comment that will be seen in the HTML source -->
</html>

In the business logic code you can configure Smarty to use this template:

define('SMARTY_DIR', 'smarty-2.6.22/' );
require_once(SMARTY_DIR . 'Smarty.class.php');
 
$smarty = new Smarty();
$smarty->template_dir = './templates/';
$smarty->compile_dir = './templates/compile/';
 
$smarty->assign('title_text', 'TITLE: This is the Smarty basic example ...');
$smarty->assign('body_html', '<p>BODY: This is the message set using assign()</p>');
 
$smarty->display('index.tpl');

Notes and references

  1. ^ Smarty separates PHP code, (often represented as business logic) from HTML, (often represented as presentation logic).
  2. ^ Parr, Terence John (2004). Enforcing strict model-view separation in template engines. Proceedings of the 13th international conference on World Wide Web. ISBN 1-58113-844-X. 

See also

External links


 
 

 

Copyrights:

Dictionary. The American Heritage® Dictionary of the English Language, Fourth Edition Copyright © 2007, 2000 by Houghton Mifflin Company. Updated in 2007. Published by Houghton Mifflin Company. All rights reserved.  Read more
Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2009 Computer Language Company Inc.  All rights reserved.  Read more
Food and Nutrition. A Dictionary of Food and Nutrition. Copyright © 1995, 2003, 2005 by A. E. Bender and D. A. Bender. All rights reserved.  Read more
Thesaurus. Roget's II: The New Thesaurus, Third Edition by the Editors of the American Heritage® Dictionary Copyright © 1995 by Houghton Mifflin Company. Published by Houghton Mifflin Company. All rights reserved.  Read more
Wikipedia. This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Smarty" Read more

 

Mentioned in