DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Getting overlaid records in a single callΒΆ

Using the "overlays" library the code in the previous chapter is reduced to the following:

$news = \Cobweb\Overlays\OverlayEngine::getAllRecordsForTable('title', 'tt_news');
$content .= '<ul>';
foreach ($news as $item) {
    $content .= '<li>' . $item['title'] . '</li>';
}
$content .= '</ul>';

The \Cobweb\Overlays\OverlayEngine::getAllRecordsForTable() method takes the same arguments as \TYPO3\CMS\Core\Database\DatabaseConnection::exec_SELECTquery(), but takes care of all the enable fields and all the translation process.

On top of this the "overlays" library is so structured that all translation overlays are gotten in a single database request. The normal TYPO3 CMS process generates one query per record to overlay. Thus "overlays" plays much nicer to your database. This comes at the price of some additional PHP processing.