Monday, August 19, 2013

How to use Contao Model arrOptions

just a quick snippet, feel free to comment if you need more details

<?php

$columns = $values = array();

$columns[] = 'published = ?';
$values[] = '1';

$arrOptions = array(
'column' => $columns,
'value' => $values,
'offset' => 0,
'limit' => 10,
'return' => 'Collection',
'uncached' => true
);
// using getModelClassFromTable is a nice way to take refactoring in mind
$model = $this->getModelClassFromTable('tl_page');
$collection = $model::findAll($arrOptions);

?>