Tips & TricksBlank Variable Handling
There may be times when you want to print a default value for an empty
variable instead of printing nothing, such as printing " " so that
table backgrounds work properly. Many would use an {if} statement to
handle this, but there is a shorthand way with Smarty, using the
default variable modifier.
Printing when a variable is emptyDefault Variable Handling
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.
Assigning a template variable its default valuePassing variable title to header template
When the majority of your templates use the same headers and footers, it
is common to split those out into their own templates and include them.
But what if the header needs to have a different title, depending on
what page you are coming from? You can pass the title to the header when
it is included.
Passing the title variable to the header template{$title|default:"BC News"}
footer.tpl
----------