contao/test — Issue #2488: News (+ other list modules) skipFirst=1 not working when only 1 item
Author: importer
Created: 2011-11-29 09:46:02+00:00
State: open
Labels: Defect, news

The News module doesn't work correctly in the following case.

Make a News archive with only 1 item of news.
Set the Newslist module up to skip the first 1 item, so no items should be displayed in the list (as the only item is skipped). Do not set page or limit values up.
This situation is used to list all news items (without paging or limits) with the first item being featured in a box above.

The newslist still displays the 1 news item and does not skip the first item. The problem occurs in the code here:

```
// Limit the result
if (isset($limit))
{
$objArticles->limit($limit, $offset + $skipFirst);
}
elseif ($skipFirst > 0 && $total > 0)
{
$objArticles->limit($total, $skipFirst);
}

```

The line:

```
elseif ($skipFirst > 0 && $total > 0)
```

this causes the system to NOT limit, if I've setup skipFirst ==1 (>) but the total is 0 (because that is calculated by

```
$total = $objTotal->total - $skipFirst;
```

This is most likely shared code, so it will happen in other modules.

--- _Originally created by thyon on August 29th, 2010, at 11:25am (ID 2488)_