Sign In
Start Page | Recent Changes | All Pages | Orphan Pages | Junebug Help

Extension - Model Tags

Simple examples

Query all records of a given model


<r:model name="Product">
  <r:find:each>
    <r:value name="id" />, 
    <r:value name="price" />, 
    <r:value name="name" /> <br>
  </r:find:each>
</r:model>

Simple search with conditions


<r:model name="Product">
  <r:find conditions="price>1">
    <r:each>
      <r:value name="id" />, 
      <r:value name="price" />, 
      <r:value name="name" /> <br>
    </r:each>
    Number of records returned: <r:count />
  </r:find>
</r:model>

Summary of the tags shown

model tag

Attribute:
  • name: (required) specify model name here

model:find

There are two main operation modes for model:find:

  • if id attribute was given that it returns the record with the given id
  • if no id was specified than a group of records will be returned

Either modes support the same tags.

  • limit, order, conditions attributes will be passed to Model.find(...)

If distinct attribute was given than the following query will run: SELECT DISTINCT(distinct) FROM model WHERE conditions etc…


Version 5 | Other versions: « older newer » current versions
Page last edited by dbeck on September 12, 2007 08:18 AM (diff)