context

Enter a new context.

see find, unknown
<r:context find='all' select='pages where name like "b%" in site'/>
  ...
</r:context>

pseudo sql

The “select” argument should contain pseudo sql code, either complete with all arguments:

<r:context select='images where updated_at gt now - 2 days in site'>
  ...
</r:context>

Or with arguments in separate attributes:

<r:context select='images' where='updated_at gt now - 2 days' in='site'>
  ...
</r:images>

Finally, it is better style to use unknown resolution instead of the “context” tag (but this is not always possible if you have a name clash with zafu tags or RubyLess methods):

<r:images where='updated_at gt now - 2 days' in='site'>
  ...
</r:images>

Same with an html tag and the “do” syntax:

<ul do='images' where='updated_at gt now - 2 days' in='site'>
  ...
</ul>

tag rendering

If the new context is empty, the tag is not rendered unless it contains an add method and the visitor has write access to the new context.

<ul do='references'>...</ul>

In the example above, if ‘references’ is empty, the ul tag will not be present in the rendered page.

ajax pagination

An ajax pagination lets you update only a specific block (id pagir in this example) when the user presses on “previous” or “next”.

<div id='pagir' do='block'>
  <ul do='images' in='site' order='created_at desc' limit='8' paginate='foo'>
    <li><b do='[foo_nodes]'/> nodes</li>
    <li>
      <r:link update='pagir' page='previous' do='t'>previous</r:link>
      <r:show var='foo'/>/<r:show var='foo_count'/>
      <r:link update='pagir' page='next' do='t'>next</r:link>
    </li>
    <li do='each' do='link' do='img'/>
  </ul>
</div>

Note the special variables “foo_count”, “foo_nodes” and “foo” named after the paginate key. These variables have the following meaning:

  • foo_count page count
  • foo_nodes number of nodes
  • foo current page number

The page size is defined by the limit clause in the pseudo sql finder (8 in our example).