Method run for all dynamic tags. |
|
| see context, date selection, edit, else, link, node, pagination ! | |
|
This method abstracts all relations between nodes. It is used to change the context.
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. In the example above, if ‘references’ is empty, the ul tag will not be present in the rendered page.
You can use the attributes from the node, its version and its dynamic attributes in the pseudo sql clause. Please note that you can only use ‘and’ in this clause. Try to use as few dynamic attributes in the clause because each one adds a join to the SQL query making it slower.
The last example above produces a single sql query, mixing ‘notes’ and ‘news’ into a single list.
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).