diff --git a/docs/appendixes.sgml b/docs/appendixes.sgml
index 7b00e877..3efb1b64 100644
--- a/docs/appendixes.sgml
+++ b/docs/appendixes.sgml
@@ -88,7 +88,7 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
If a variable is used frequently throughout your templates, applying
the default modifier every time it is mentioned can get a bit ugly. You
can remedy this by assigning the variable its default value with the
- assign function.
+ assign function.
Assigning a template variable its default value
diff --git a/docs/designers.sgml b/docs/designers.sgml
index e939b52b..06a461e9 100644
--- a/docs/designers.sgml
+++ b/docs/designers.sgml
@@ -1,24 +1,29 @@
-
- Smarty For Template Designers
+
+ Smarty For Template DesignersTemplate Language
- The templates are the heart of Smarty. These are the files that the designers
+ The templates are the language of Smarty. These are the files that the designers
work with. They're basically pages made up of static content interspersed with
template markup tags. These tags are placeholders for variables or blocks of logic.
Basic Syntax
+
+ All Smarty template tags are enclosed within delimiters. By
+ default, these delimiters are { and
+ }, but they can be changed.
+
For these examples, we will assume that you are using the default
- template tag delimiters, which are "{" and "}". In Smarty, all content
- outside of delimiter tags is displayed as static content, or unchanged.
- When Smarty encounters template tags {}, it attempts to interpret what is
- between the tags, and displays the appropriate output in place of them.
+ delimiters. In Smarty, all content outside of delimiters is displayed as
+ static content, or unchanged. When Smarty encounters template tags, it
+ attempts to interpret them, and displays the appropriate output in their
+ place.
-
+ Comments
Template comments are surrounded by asterisks, and that is surrounded
@@ -44,38 +49,19 @@
</SELECT>
-
- Attributes
-
- Attributes to functions are much like HTML attributes. Static
- values don't have to be enclosed in quotes, but it is recommended
- for literal strings. If not quoted, you may use a syntax that Smarty may confuse
- with another function, such as a boolean value. Variables may
- also be used, and should not be in quotes.
-
-
-function attribute syntax
-
-{include file="header.tpl"}
-{include file=$includeFile}
-
-{include file=#includeFile#}
-
-<SELECT name=company>
-{html_options values=$vals selected=$selected output=$output}
-</SELECT>
-
-
-
- blah
-
- Functions are processed and displayed by enclosing the function and its
- attributes into delimiters like so: {funcname attr1="val" attr2="val"}
-
-
- function syntax
-
+
+ Functions
+
+ Each Smarty tag either prints a
+ variable or invokes some sort
+ of function. Functions are processed and displayed by enclosing the
+ function and its attributes into delimiters like so: {funcname
+ attr1="val" attr2="val"}.
+
+
+ function syntax
+
{config_load file="colors.conf"}
{include file="header.tpl"}
@@ -87,22 +73,51 @@
{/if}
{include file="footer.tpl"}
+
+
+ Both built-in functions and custom functions have the same syntax in
+ the templates. Built-in functions are the inner workings of Smarty,
+ such as if, section and
+ strip. They cannot be modified. Custom functions are
+ additional functions implemented via plugins. They can be modified to
+ your liking, or you can add new ones. html_options and
+ html_select_date are examples of custom functions.
+
+
+
+
+ Attributes
+
+ Most of the functions take attributes that specify or modify
+ their behavior. Attributes to Smarty functions are much like HTML
+ attributes. Static values don't have to be enclosed in quotes, but it
+ is recommended for literal strings. Variables may also be used, and
+ should not be in quotes.
+
+
+ Some attributes require boolean values (true or false). These can be
+ specified as either unquoted true,
+ on, and yes, or
+ false, off, and
+ no.
+
+
+ function attribute syntax
+
+{include file="header.tpl"}
+
+{include file=$includeFile}
+
+{include file=#includeFile#}
+
+{html_select_date display_days=yes}
+
+<SELECT name=company>
+{html_options values=$vals selected=$selected output=$output}
+</SELECT>
-
- Both built-in functions and custom functions have the same syntax
- in the templates. Built-in functions are the inner workings of
- Smarty, such as {if}, {section} and {strip}. They cannot be
- modified. Custom functions are located in the Smarty.addons.class
- file. They can be modified to your liking, or add new ones.
- {html_options} and {html_select_date} are examples of custom
- functions.
-
-
- Custom functions in Smarty work much the same as the built-in functions,
- except that built-in functions cannot be modified. Custom functions are
- located in Smarty.addons.php, built-in functions are not.
-
-
+
+
@@ -1194,14 +1209,14 @@ s m o k e r s a r e p. . .
-
+ Built-in Functions
Smarty comes with several built-in functions. Built-in functions
are integral to the template language. You cannot create custom
functions with the same names, nor can you modify built-in functions.
-
+ capture
capture is used to collect the output of the template into a
@@ -1246,7 +1261,7 @@ s m o k e r s a r e p. . .
-
+ config_load
@@ -1364,7 +1379,7 @@ s m o k e r s a r e p. . .
</html>
-
+ include
@@ -1466,7 +1481,7 @@ s m o k e r s a r e p. . .
{include file="db:header.tpl"}
-
+ include_php
@@ -1557,7 +1572,7 @@ index.tpl
{/foreach}
-
+ insert
@@ -1673,7 +1688,7 @@ index.tpl
weather, search results, user feedback areas, etc.
-
+ if,elseif,else
if statements in Smarty have much the same flexibility as php if
@@ -1753,7 +1768,7 @@ index.tpl
{/if}
-
+ ldelim,rdelim
ldelim and rdelim are used for displaying the literal delimiter, in
@@ -1773,7 +1788,7 @@ OUTPUT:
{funcname} is how functions look in Smarty!
-
+ literal
Literal tags allow a block of data to be taken literally,
@@ -1805,7 +1820,7 @@ OUTPUT:
{/literal}
-
+ php
php tags allow php to be embedded directly into the template. They
@@ -1824,7 +1839,7 @@ OUTPUT:
{/php}
-
+ section,sectionelse
@@ -2370,7 +2385,7 @@ e-mail: jane@mydomain.com<p>
-
+ foreach,foreachelse
@@ -2484,7 +2499,7 @@ fax: 555-3333<br>
cell: 760-1234<br>
-
+ strip
Many times web designers
@@ -2531,16 +2546,16 @@ OUTPUT:
-
- Additional Functions
+
+ Custom Functions
Smarty comes with several additional functions that you can
use in the templates.
-
- Available Functions
-
+
+ Additional Functions
+ assign
@@ -2595,7 +2610,7 @@ OUTPUT:
The value of $name is Bob.
-
+ counter
@@ -2692,7 +2707,7 @@ OUTPUT:
8<br>
-
+ fetch
@@ -2771,7 +2786,7 @@ OUTPUT:
{/if}
-
+ html_options
@@ -2861,7 +2876,7 @@ OUTPUT:
</select>
-
+ html_select_date
@@ -3141,7 +3156,7 @@ OUTPUT:
</select>
-
+ html_select_time
@@ -3402,7 +3417,7 @@ OUTPUT:
</select>
-
+ math
@@ -3516,14 +3531,14 @@ OUTPUT:
9.44
-
+ popup_init
popup is an integration of overLib, a library used for popup
windows. These are used for context sensitive information, such as
help windows or tooltips. popup_init must be called once at the
top of any page you plan on using the popup function. overLib
+ linkend="language.function.popup">popup function. overLib
was written by Erik Bosrup, and the homepage is located at
http://www.bosrup.com/web/overlib/.
@@ -3531,7 +3546,7 @@ OUTPUT:
This was added to Smarty 1.4.4.
-
+ popup
diff --git a/docs/getting-started.sgml b/docs/getting-started.sgml
index 563d41cf..44393ddd 100644
--- a/docs/getting-started.sgml
+++ b/docs/getting-started.sgml
@@ -1,5 +1,6 @@
-
- Getting Started
+
+ Getting Started
+
Overview
@@ -95,67 +96,67 @@
- Installation
+ Installation
-
- Requirements
-
- Smarty requires PHP 4.0.4pl1 or later. See the
- BUGS section for caveats.
-
-
+
+ Requirements
+
+ Smarty requires PHP 4.0.4pl1 or later. See the
+ BUGS section for caveats.
+
+
-
- Installing Smarty
-
- Installing Smarty is fairly straightforward, there are a few things to
- be aware of. Smarty creates PHP scripts from the templates. This
- usually means allowing user "nobody" (or whomever the web server runs
- as) to have permission to write the files. Each installation of a
- Smarty application minimally needs a templates directory and a compiled
- templates directory. If you use configuration files you will also need
- a directory for those. By default these are named "templates",
- "templates_c" and "configs" respectively. If you plan on using caching,
- you will need to create a "cache" directory, also with permission to
- write files.
-
-
- TECHNICAL NOTE: You can get around the need to allow the web server
- user write access to compile templates. Smarty needs to compile the
- templates only once. This can be done from the command line, using the
- CGI version of PHP. example: "php -q index.php". Once the templates are
- compiled, they should run fine from the web environment. If you change
- a template, you must recompile from the command line again. If you do
- not have the CGI version of PHP available and you are concerned about
- world-writable directory access, you can chmod 777 the compile_dir, let
- the templates compile once as the web server user, then change the
- directory mode to 755. If you are using the caching feature of Smarty,
- the cache directory must always have write access for the web server
- user.
-
-
- TECHNICAL NOTE: If you do not have access to the php.ini file, you can
- change non-server settings (such as your include_path) with the
- ini_set() command (available in PHP 4.0.4 or later.) example:
- ini_set("include_path",".:/usr/local/lib/php");
-
-
- Copy the Smarty.class.php, Smarty.addons.php and Config_File.class.php
- scripts to a directory that is in your PHP include_path. NOTE: PHP will
- try to create a directory alongside the executing script called
- "templates_c". Be sure that directory permissions allow this to happen.
- You will see PHP error messages if this fails. You can also create the
- directory yourself before hand, and change the file ownership
- accordingly. See below.
-
-
- TECHNICAL NOTE: If you don't want to use include_path to find the
- Smarty files, you can set the SMARTY_DIR constant to the full path to
- your Smarty library files. Be sure the path ends with a slash!
-
-
- Example of installing Smarty
-
+
+ Installing Smarty
+
+ Installing Smarty is fairly straightforward, there are a few things to
+ be aware of. Smarty creates PHP scripts from the templates. This
+ usually means allowing user "nobody" (or whomever the web server runs
+ as) to have permission to write the files. Each installation of a
+ Smarty application minimally needs a templates directory and a compiled
+ templates directory. If you use configuration files you will also need
+ a directory for those. By default these are named "templates",
+ "templates_c" and "configs" respectively. If you plan on using caching,
+ you will need to create a "cache" directory, also with permission to
+ write files.
+
+
+ TECHNICAL NOTE: You can get around the need to allow the web server
+ user write access to compile templates. Smarty needs to compile the
+ templates only once. This can be done from the command line, using the
+ CGI version of PHP. example: "php -q index.php". Once the templates are
+ compiled, they should run fine from the web environment. If you change
+ a template, you must recompile from the command line again. If you do
+ not have the CGI version of PHP available and you are concerned about
+ world-writable directory access, you can chmod 777 the compile_dir, let
+ the templates compile once as the web server user, then change the
+ directory mode to 755. If you are using the caching feature of Smarty,
+ the cache directory must always have write access for the web server
+ user.
+
+
+ TECHNICAL NOTE: If you do not have access to the php.ini file, you can
+ change non-server settings (such as your include_path) with the
+ ini_set() command (available in PHP 4.0.4 or later.) example:
+ ini_set("include_path",".:/usr/local/lib/php");
+
+
+ Copy the Smarty.class.php, Smarty.addons.php and Config_File.class.php
+ scripts to a directory that is in your PHP include_path. NOTE: PHP will
+ try to create a directory alongside the executing script called
+ "templates_c". Be sure that directory permissions allow this to happen.
+ You will see PHP error messages if this fails. You can also create the
+ directory yourself before hand, and change the file ownership
+ accordingly. See below.
+
+
+ TECHNICAL NOTE: If you don't want to use include_path to find the
+ Smarty files, you can set the SMARTY_DIR constant to the full path to
+ your Smarty library files. Be sure the path ends with a slash!
+
+
+ Example of installing Smarty
+
# be sure you are in the web server document tree
# this assumes your web server runs as user "nobody"
# and you are in a un*x environment
@@ -167,32 +168,33 @@ chmod 700 templates_c
mkdir cache
chown nobody:nobody cache
chmod 700 cache
-
-
- Next, try running the index.php script from your web browser.
-
-
-
- Constants
-
+
+
+ Next, try running the index.php script from your web browser.
+
+
-
- SMARTY_DIR
-
- This should be the full system path to the location of the Smarty
- class files. If this is not defined, then Smarty will attempt to
- determine the appropriate value automatically. If defined, the path
- must end with a slash.
-
-
- SMARTY_DIR
-
+
+ Constants
+
+
+
+ SMARTY_DIR
+
+ This should be the full system path to the location of the Smarty
+ class files. If this is not defined, then Smarty will attempt to
+ determine the appropriate value automatically. If defined, the path
+ must end with a slash.
+
+
+ SMARTY_DIR
+
// set path to Smarty directory
define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
require_once(SMARTY_DIR."Smarty.class.php");
-
-
-
-
-
+
+
+
+
+
diff --git a/docs/html-common.dsl b/docs/html-common.dsl
index 29a99f06..7fd772c5 100644
--- a/docs/html-common.dsl
+++ b/docs/html-common.dsl
@@ -181,6 +181,52 @@
)
(literal "()"))))))))
+(element command
+ (let* ((command-name (data (current-node)))
+ (linkend
+ (string-append
+ "language.function."
+ (string-replace
+ (string-replace command-name "_" ".")
+ "::" ".")))
+ (target (element-with-id linkend))
+ (parent-gi (gi (parent))))
+ (cond
+ ;; function names should be plain in FUNCDEF
+ ((equal? parent-gi "funcdef")
+ (process-children))
+
+ ;; if a valid ID for the target function is not found, or if the
+ ;; FUNCTION tag is within the definition of the same function,
+ ;; make it bold, add (), but don't make a link
+ ((or (node-list-empty? target)
+ (equal? (case-fold-down
+ (data (node-list-first
+ (select-elements
+ (node-list-first
+ (children
+ (select-elements
+ (children
+ (ancestor-member (parent) (list "refentry")))
+ "refnamediv")))
+ "refname"))))
+ command-name))
+ ($bold-seq$
+ (make sequence
+ (literal "{")
+ (process-children)
+ (literal "}"))))
+
+ ;; else make a link to the function and add ()
+ (else
+ (make element gi: "A"
+ attributes: (list
+ (list "HREF" (href-to target)))
+ ($bold-seq$
+ (make sequence
+ (literal "{")
+ (process-children)
+ (literal "}"))))))))
(element classname
(let* ((class-name (data (current-node)))