Define a custom tag. A custom tag is in a callable tag that works like builtin logic tags. Here's an example of defining a custom tag:
<tag name="getstock"><doc>Get count of available stock</doc><signature><attribute name="product" /></signature><db:get model="#Product.name == product" dst="product"/><return value="product.count"/></tag>
You may define a custom tag anywhere in a library. Once defined, the tag is available to any code that uses the appropriate namespace defined in lib.ini
. For example, if the above tag is defined in a library with an xml namespace of http://moyaproject.com/sushifinder
, it could be invoked with the following file:
<moya xmlns:sushifinder="http://moyaproject.com/sushifinder"><macro name="main"><sushifinder:getstock product="tuna-roll" dst="count" /><echo>We have ${count} tuna rolls in stock.</echo></macro></moya>
Custom tags are preferred over macros when exposing functionality to other libraries.
name | purpose | type | required? | default | choices |
---|---|---|---|---|---|
let |
Let destination | text | No | ||
name |
Tag name | text | Yes | ||
ns |
XML Namespace | text | No | ||
synopsis |
Short description of tag | text | No | ||
undocumented |
Set to yes to disabled documentation for this tag | boolean | No | no |