lookup
This filter looks up a value in a database table based upon the supplied
table and column names.
The [filter] tag's body text is used as the key to look up.
If the key cannot be found in the table then the original input value
will be returned.
This filter takes two parameters,
which are the table to use and the and column
value to return for the specified key.
The two parameters are separated with a single dot (.).
Also see the [data] tag.
Example
|
[filter lookup.country.name]UK[/filter]
|
or
[tmpn country]UK[/tmpn]
[filter op="lookup.country.name" interpolate=1][scratch country][/filter]
|
Results in:
Source code
sub {
my ($val, $tag, $table, $column) = @_;
return tag_data($table, $column, $val) || $val;
}
|