aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty/demo
diff options
context:
space:
mode:
Diffstat (limited to 'library/Smarty/demo')
-rw-r--r--library/Smarty/demo/index.php25
-rw-r--r--library/Smarty/demo/plugins/cacheresource.apc.php28
-rw-r--r--library/Smarty/demo/plugins/cacheresource.memcache.php36
-rw-r--r--library/Smarty/demo/plugins/cacheresource.mysql.php96
-rw-r--r--library/Smarty/demo/plugins/resource.extendsall.php32
-rw-r--r--library/Smarty/demo/plugins/resource.mysql.php35
-rw-r--r--library/Smarty/demo/plugins/resource.mysqls.php28
-rw-r--r--library/Smarty/demo/templates/header.tpl2
-rw-r--r--library/Smarty/demo/templates/index.tpl91
9 files changed, 201 insertions, 172 deletions
diff --git a/library/Smarty/demo/index.php b/library/Smarty/demo/index.php
index 74c8e8971..33f3035c5 100644
--- a/library/Smarty/demo/index.php
+++ b/library/Smarty/demo/index.php
@@ -1,33 +1,30 @@
<?php
- /**
+/**
* Example Application
-
+ *
* @package Example-application
*/
-require('../libs/Smarty.class.php');
+require '../libs/Smarty.class.php';
$smarty = new Smarty;
-
-
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
-$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill",true);
-$smarty->assign("FirstName",array("John","Mary","James","Henry"));
-$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
-$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
- array("I", "J", "K", "L"), array("M", "N", "O", "P")));
+$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
+$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
+$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
+$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"),
+ array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
- array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
+ array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
-$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
-$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
+$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
+$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
$smarty->assign("option_selected", "NE");
$smarty->display('index.tpl');
-?>
diff --git a/library/Smarty/demo/plugins/cacheresource.apc.php b/library/Smarty/demo/plugins/cacheresource.apc.php
index 00ba59817..d7336f2bf 100644
--- a/library/Smarty/demo/plugins/cacheresource.apc.php
+++ b/library/Smarty/demo/plugins/cacheresource.apc.php
@@ -2,19 +2,19 @@
/**
* APC CacheResource
- *
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
* *
+ *
* @package CacheResource-examples
- * @author Uwe Tews
+ * @author Uwe Tews
*/
-class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
-
+class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
+{
public function __construct()
{
// test if APC is present
- if(!function_exists('apc_cache_info')) {
+ if (!function_exists('apc_cache_info')) {
throw new Exception('APC Template Caching Error: APC is not installed');
}
}
@@ -22,8 +22,9 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
- * @return array list of values with the given keys used as indexes
+ * @param array $keys list of keys to fetch
+ *
+ * @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
@@ -33,28 +34,32 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
foreach ($res as $k => $v) {
$_res[$k] = $v;
}
+
return $_res;
}
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected function write(array $keys, $expire=null)
+ protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
apc_store($k, $v, $expire);
}
+
return true;
}
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
@@ -62,6 +67,7 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
foreach ($keys as $k) {
apc_delete($k);
}
+
return true;
}
diff --git a/library/Smarty/demo/plugins/cacheresource.memcache.php b/library/Smarty/demo/plugins/cacheresource.memcache.php
index 230607d69..e265365fb 100644
--- a/library/Smarty/demo/plugins/cacheresource.memcache.php
+++ b/library/Smarty/demo/plugins/cacheresource.memcache.php
@@ -2,34 +2,35 @@
/**
* Memcache CacheResource
- *
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
- *
* Note that memcache has a limitation of 256 characters per cache-key.
* To avoid complications all cache-keys are translated to a sha1 hash.
*
* @package CacheResource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
+class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
+{
/**
* memcache instance
+ *
* @var Memcache
*/
protected $memcache = null;
-
+
public function __construct()
{
$this->memcache = new Memcache();
- $this->memcache->addServer( '127.0.0.1', 11211 );
+ $this->memcache->addServer('127.0.0.1', 11211);
}
-
+
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
- * @return array list of values with the given keys used as indexes
+ * @param array $keys list of keys to fetch
+ *
+ * @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
@@ -45,29 +46,33 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
foreach ($res as $k => $v) {
$_res[$lookup[$k]] = $v;
}
+
return $_res;
}
-
+
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected function write(array $keys, $expire=null)
+ protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
$k = sha1($k);
$this->memcache->set($k, $v, 0, $expire);
}
+
return true;
}
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
@@ -76,6 +81,7 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
$k = sha1($k);
$this->memcache->delete($k);
}
+
return true;
}
@@ -86,6 +92,6 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
*/
protected function purge()
{
- return $this->memcache->flush();
+ $this->memcache->flush();
}
}
diff --git a/library/Smarty/demo/plugins/cacheresource.mysql.php b/library/Smarty/demo/plugins/cacheresource.mysql.php
index ab8c47516..d8d00ab26 100644
--- a/library/Smarty/demo/plugins/cacheresource.mysql.php
+++ b/library/Smarty/demo/plugins/cacheresource.mysql.php
@@ -2,10 +2,8 @@
/**
* MySQL CacheResource
- *
* CacheResource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's output caching.
- *
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `output_cache` (
* `id` CHAR(40) NOT NULL COMMENT 'sha1 hash',
@@ -22,19 +20,22 @@
* ) ENGINE = InnoDB;</pre>
*
* @package CacheResource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
+class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
+{
// PDO instance
protected $db;
protected $fetch;
protected $fetchTimestamp;
protected $save;
-
- public function __construct() {
+
+ public function __construct()
+ {
try {
- $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
- } catch (PDOException $e) {
+ $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
@@ -46,19 +47,20 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
/**
* fetch cached content and its modification time from data source
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $content cached content
- * @param integer $mtime cache modification timestamp (epoch)
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $content cached content
+ * @param integer $mtime cache modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime)
{
$this->fetch->execute(array('id' => $id));
$row = $this->fetch->fetch();
- $this->fetch->closeCursor();
+ $this->fetch->closeCursor();
if ($row) {
$content = $row['content'];
$mtime = strtotime($row['modified']);
@@ -67,15 +69,17 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
$mtime = null;
}
}
-
+
/**
* Fetch cached content's modification timestamp from data source
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content.
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
+ *
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ *
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
@@ -83,40 +87,44 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
$this->fetchTimestamp->execute(array('id' => $id));
$mtime = strtotime($this->fetchTimestamp->fetchColumn());
$this->fetchTimestamp->closeCursor();
+
return $mtime;
}
-
+
/**
* Save content to cache
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer|null $exp_time seconds till expiration time in seconds or null
- * @param string $content content to cache
- * @return boolean success
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer|null $exp_time seconds till expiration time in seconds or null
+ * @param string $content content to cache
+ *
+ * @return boolean success
*/
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
{
$this->save->execute(array(
- 'id' => $id,
- 'name' => $name,
- 'cache_id' => $cache_id,
- 'compile_id' => $compile_id,
- 'content' => $content,
- ));
+ 'id' => $id,
+ 'name' => $name,
+ 'cache_id' => $cache_id,
+ 'compile_id' => $compile_id,
+ 'content' => $content,
+ ));
+
return !!$this->save->rowCount();
}
-
+
/**
* Delete content from cache
*
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer|null $exp_time seconds till expiration or null
- * @return integer number of deleted caches
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer|null $exp_time seconds till expiration or null
+ *
+ * @return integer number of deleted caches
*/
protected function delete($name, $cache_id, $compile_id, $exp_time)
{
@@ -124,7 +132,8 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) {
// returning the number of deleted caches would require a second query to count them
$query = $this->db->query('TRUNCATE TABLE output_cache');
- return -1;
+
+ return - 1;
}
// build the filter
$where = array();
@@ -142,11 +151,12 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
}
// equal test cache_id and match sub-groups
if ($cache_id !== null) {
- $where[] = '(cache_id = '. $this->db->quote($cache_id)
- . ' OR cache_id LIKE '. $this->db->quote($cache_id .'|%') .')';
+ $where[] = '(cache_id = ' . $this->db->quote($cache_id)
+ . ' OR cache_id LIKE ' . $this->db->quote($cache_id . '|%') . ')';
}
// run delete query
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
+
return $query->rowCount();
}
}
diff --git a/library/Smarty/demo/plugins/resource.extendsall.php b/library/Smarty/demo/plugins/resource.extendsall.php
index d8c40b5ba..500b3c862 100644
--- a/library/Smarty/demo/plugins/resource.extendsall.php
+++ b/library/Smarty/demo/plugins/resource.extendsall.php
@@ -2,49 +2,51 @@
/**
* Extends All Resource
- *
* Resource Implementation modifying the extends-Resource to walk
* through the template_dirs and inherit all templates of the same name
- *
+ *
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
-
+class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
+{
/**
* populate Source Object with meta data from Resource
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$uid = '';
$sources = array();
$exists = true;
foreach ($_template->smarty->getTemplateDir() as $key => $directory) {
try {
- $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name );
+ $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name);
if (!$s->exists) {
continue;
}
$sources[$s->uid] = $s;
$uid .= $s->filepath;
}
- catch (SmartyException $e) {}
+ catch (SmartyException $e) {
+ }
}
-
+
if (!$sources) {
$source->exists = false;
$source->template = $_template;
+
return;
}
-
+
$sources = array_reverse($sources, true);
reset($sources);
$s = current($sources);
-
+
$source->components = $sources;
$source->filepath = $s->filepath;
$source->uid = sha1($uid);
@@ -55,6 +57,4 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
// need the template at getContent()
$source->template = $_template;
}
-}
-
-?> \ No newline at end of file
+}
diff --git a/library/Smarty/demo/plugins/resource.mysql.php b/library/Smarty/demo/plugins/resource.mysql.php
index 312f3fc73..dfc9606b4 100644
--- a/library/Smarty/demo/plugins/resource.mysql.php
+++ b/library/Smarty/demo/plugins/resource.mysql.php
@@ -2,10 +2,8 @@
/**
* MySQL Resource
- *
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
- *
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
@@ -13,14 +11,14 @@
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
- *
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
+class Smarty_Resource_Mysql extends Smarty_Resource_Custom
+{
// PDO instance
protected $db;
// prepared fetch() statement
@@ -28,22 +26,25 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
// prepared fetchTimestamp() statement
protected $mtime;
- public function __construct() {
+ public function __construct()
+ {
try {
- $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
- } catch (PDOException $e) {
+ $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
$this->mtime = $this->db->prepare('SELECT modified FROM templates WHERE name = :name');
}
-
+
/**
* Fetch a template and its modification time from database
*
- * @param string $name template name
- * @param string $source template source
- * @param integer $mtime template modification timestamp (epoch)
+ * @param string $name template name
+ * @param string $source template source
+ * @param integer $mtime template modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($name, &$source, &$mtime)
@@ -59,18 +60,22 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
$mtime = null;
}
}
-
+
/**
* Fetch a template's modification time from database
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source.
- * @param string $name template name
+ *
+ * @param string $name template name
+ *
* @return integer timestamp (epoch) the template was modified
*/
- protected function fetchTimestamp($name) {
+ protected function fetchTimestamp($name)
+ {
$this->mtime->execute(array('name' => $name));
$mtime = $this->mtime->fetchColumn();
$this->mtime->closeCursor();
+
return strtotime($mtime);
}
}
diff --git a/library/Smarty/demo/plugins/resource.mysqls.php b/library/Smarty/demo/plugins/resource.mysqls.php
index f9fe1c2f2..f694ddf11 100644
--- a/library/Smarty/demo/plugins/resource.mysqls.php
+++ b/library/Smarty/demo/plugins/resource.mysqls.php
@@ -2,13 +2,10 @@
/**
* MySQL Resource
- *
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
- *
* Note that this MySQL implementation fetches the source and timestamps in
- * a single database query, instead of two seperate like resource.mysql.php does.
- *
+ * a single database query, instead of two separate like resource.mysql.php does.
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
@@ -16,34 +13,37 @@
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
- *
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_Resource_Mysqls extends Smarty_Resource_Custom {
+class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
+{
// PDO instance
protected $db;
// prepared fetch() statement
protected $fetch;
- public function __construct() {
+ public function __construct()
+ {
try {
- $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
- } catch (PDOException $e) {
+ $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
}
-
+
/**
* Fetch a template and its modification time from database
*
- * @param string $name template name
- * @param string $source template source
- * @param integer $mtime template modification timestamp (epoch)
+ * @param string $name template name
+ * @param string $source template source
+ * @param integer $mtime template modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($name, &$source, &$mtime)
diff --git a/library/Smarty/demo/templates/header.tpl b/library/Smarty/demo/templates/header.tpl
index 783210a18..13fa6cb5a 100644
--- a/library/Smarty/demo/templates/header.tpl
+++ b/library/Smarty/demo/templates/header.tpl
@@ -1,5 +1,5 @@
<HTML>
<HEAD>
-<TITLE>{$title} - {$Name}</TITLE>
+ <TITLE>{$title} - {$Name}</TITLE>
</HEAD>
<BODY bgcolor="#ffffff">
diff --git a/library/Smarty/demo/templates/index.tpl b/library/Smarty/demo/templates/index.tpl
index 38d233412..1fbb6d379 100644
--- a/library/Smarty/demo/templates/index.tpl
+++ b/library/Smarty/demo/templates/index.tpl
@@ -4,18 +4,18 @@
<PRE>
{* bold and title are read from the config file *}
-{if #bold#}<b>{/if}
-{* capitalize the first letters of each word of the title *}
-Title: {#title#|capitalize}
-{if #bold#}</b>{/if}
+ {if #bold#}<b>{/if}
+ {* capitalize the first letters of each word of the title *}
+ Title: {#title#|capitalize}
+ {if #bold#}</b>{/if}
-The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
+ The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
-The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
+ The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
-Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
+ Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
-The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
+ The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
variable modifier example of {ldelim}$Name|upper{rdelim}
@@ -24,59 +24,64 @@ variable modifier example of {ldelim}$Name|upper{rdelim}
An example of a section loop:
-{section name=outer
-loop=$FirstName}
-{if $smarty.section.outer.index is odd by 2}
- {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
-{else}
- {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
-{/if}
-{sectionelse}
- none
-{/section}
-
-An example of section looped key values:
-
-{section name=sec1 loop=$contacts}
- phone: {$contacts[sec1].phone}<br>
- fax: {$contacts[sec1].fax}<br>
- cell: {$contacts[sec1].cell}<br>
-{/section}
-<p>
-
-testing strip tags
-{strip}
+ {section name=outer
+ loop=$FirstName}
+ {if $smarty.section.outer.index is odd by 2}
+ {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
+ {else}
+ {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
+ {/if}
+ {sectionelse}
+ none
+ {/section}
+
+ An example of section looped key values:
+
+ {section name=sec1 loop=$contacts}
+ phone: {$contacts[sec1].phone}
+ <br>
+
+ fax: {$contacts[sec1].fax}
+ <br>
+
+ cell: {$contacts[sec1].cell}
+ <br>
+ {/section}
+ <p>
+
+ testing strip tags
+ {strip}
<table border=0>
- <tr>
- <td>
- <A HREF="{$SCRIPT_NAME}">
- <font color="red">This is a test </font>
- </A>
- </td>
- </tr>
+ <tr>
+ <td>
+ <A HREF="{$SCRIPT_NAME}">
+ <font color="red">This is a test </font>
+ </A>
+ </td>
+ </tr>
</table>
-{/strip}
+ {/strip}
</PRE>
This is an example of the html_select_date function:
<form>
-{html_select_date start_year=1998 end_year=2010}
+ {html_select_date start_year=1998 end_year=2010}
</form>
This is an example of the html_select_time function:
<form>
-{html_select_time use_24_hours=false}
+ {html_select_time use_24_hours=false}
</form>
This is an example of the html_options function:
<form>
-<select name=states>
-{html_options values=$option_values selected=$option_selected output=$option_output}
-</select>
+ <select name=states>
+ {html_options values=$option_values selected=$option_selected output=$option_output}
+ </select>
</form>
{include file="footer.tpl"}