PREFIX-pos
Summary
Description
Returns the value of the array element associated with the
looping tag's current row.
Each looping list returns an array of columns,
set in searches with
mv_return_fields.
The default is only to return the code of the search result,
but by setting those parameters you can return whichever columns you wish.
[PREFIX-pos N] outputs the data from the Nth column
(numbered with zero), as returned.
[PREFIX-param] lets you access the data by column name,
instead of by number.
In a [query] tag,
you can select multiple return columns with something like this:
[query prefix=prefix sql=|
SELECT foo, bar
FROM baz
WHERE foo = 'baz'
|]
[prefix-code], [prefix-param foo], [prefix-param bar]<br>
[/query]
|
In this case, [prefix-code] and
[prefix-param foo]
are synonyms,
as foo is the first returned column and becomes the code for this row.
Another synonym is [prefix-pos 0].
[prefix-pos 1] is the same as
[prefix-param bar],
in this example.
The following code will produce exactly the same output as the above:
[query prefix=prefix sql=|
SELECT foo, bar
FROM baz
WHERE foo = 'baz'
|]
[prefix-pos 0], [prefix-pos 0], [prefix-pos 1]<br>
[/query]
|
Note that if you use the [PREFIX-pos] tag,
you may have to review your column numbers whenever you modify
the columns you select.
For this reason, queries that make use of the [PREFIX-param]
tag may be easier to maintain and will be less prone to future surprises.
See also