Finding items by ID
VaeQL provides a shortcut that allows you to locate any item by its ID (which is globally unique across Vae). Simply pass in that ID as the first part of your path. For example, this snippet will render the name structure of entry number 12345:
<v:text path="12345/name" />
You can pull in data from request (GET or POST) parameters by simply using a dollar sign ($) and the name of the parameter in your path expression. This will be useful in cases involving finding a specific item or conducting a search. For example:
<v:text path="$location_id/name" />
You can also restrict your ID search to certain fields by putting them before the ID.
For example, this code would render the text in the name structure of the entry with ID
stored in parameter $location_id
, but only if that entry is part of the
locations collection:
<v:text path="/locations/$location_id/name" />