contao/test — Issue #474: Paging in individual news item
Author: importer
Created: 2011-11-28 16:52:25+00:00
State: open
Labels: Feature, news

Working on my TagNews I wrote code to break a news item in to multiple pages. When creating a news item, they enter something like

![](break) where they want page breaks in the article text. (If you implement, please let me know what you would use as the separator and I will as well.)

The custom code in Module News is just below:

```
// Add an image
if ($objArticles->addImage && is_file(TL_ROOT . '/' . $objArticles->singleSRC))
{
.
.
.
}
```

is:

```

if(ereg('

![](break)',$objTemplate->text))
{
$textBlock = split('

![](break)',$objTemplate->text);
$page = $this->Input->get('page') ? $this->Input->get('page') : 1;
$objTemplate->text = $textBlock[$page-1];
// Add pagination menu
$objPagination = new Pagination(count($textBlock), 1);
$objTemplate->pagination = $objPagination->generate("\n ");
if($page

![](= 1)
$objTemplate->addImage = false;
}

```

Put there to turn off the addImage if on page 2+.

In the mod_tagged_full.tpl, "pagination; ?>" needs to be added.

Then in the News Text field, set the description to something like:

"Please enter the news text. Enter )break! where you want to split pages."

Just thought it would be a feature desired in the news.

--- _Originally created by bumforaliving on February 2nd, 2009, at 10:47pm (ID 474)_