MOD_AR
This module is a fully functional preview of the new store interface we are developing. The module is always loaded, you do not have to manually load it before using. The new store interface is meant to be simple to use and consistent.
Upto now the way to show a list of objects was something like this:
<pinp>
$query = "object.implements='ppage' order by name.value ASC";
find($query, 'show.html');
</pinp>
The new way looks like this:
<pinp>
ar::find("object.implements='ppage'")->order('name.value ASC')->
call('show.html');
</pinp>
The following is also supported:
<pinp>
$count = ar::find($query)->count();
$count = ar::ls()->count();
ar::parents()->call('show.html');
ar::get('/a/path/')->find($query)->call('show.html');
ar::ls()->call('show.html');
ar::ls()->limit(10)->offset(10)->call('show.html');
// etc.
</pinp>
This API works the same whether you are writing PINP templates or PHP scripts (at least for PHP5 it does). Below is a full list of methods.
ar::find($query) and ar::ls()
->call($template, $arguments)
->count()
->limit($amount) ->chainable
->offset($amount) ->chainable
->order($orderby) ->chainable
ar::get($path)
->call($template, $arguments)
->find($query) ->chainable, see ar::find
->ls() ->chainable, see ar::ls
ar::parents($path)
->call($template, $arguments)
->count()