{"id":20961756,"url":"https://github.com/heimrichhannot/contao-news-pagination-bundle","last_synced_at":"2025-05-14T07:31:00.763Z","repository":{"id":49007694,"uuid":"106392613","full_name":"heimrichhannot/contao-news-pagination-bundle","owner":"heimrichhannot","description":"Automatic or manual content pagination for news or other content in contao.","archived":false,"fork":false,"pushed_at":"2024-04-23T10:09:19.000Z","size":145,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T14:19:43.605Z","etag":null,"topics":["contao","news"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heimrichhannot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-10T08:54:07.000Z","updated_at":"2025-02-25T19:20:01.000Z","dependencies_parsed_at":"2024-04-22T16:16:09.752Z","dependency_job_id":null,"html_url":"https://github.com/heimrichhannot/contao-news-pagination-bundle","commit_stats":{"total_commits":59,"total_committers":7,"mean_commits":8.428571428571429,"dds":"0.38983050847457623","last_synced_commit":"8480092ada8f1b1ad9b2618b65a0174cee314c5d"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-news-pagination-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-news-pagination-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-news-pagination-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-news-pagination-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heimrichhannot","download_url":"https://codeload.github.com/heimrichhannot/contao-news-pagination-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254094839,"owners_count":22013648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contao","news"],"created_at":"2024-11-19T02:16:32.984Z","updated_at":"2025-05-14T07:30:59.261Z","avatar_url":"https://github.com/heimrichhannot.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# News Pagination\n\nThis bundle offers automatic content pagination for the core news reader module and the [heimrichhannot/contao-reader-bundle](https://github.com/heimrichhannot/contao-reader-bundle).\n\n## Features\n\n- add a pagination for navigating between the news parts\n- automatic splitting\n    - split news articles by an adjustable character amount respecting html tags\n- manual splitting\n    - split news content by wrapping the content elements in special start and stop content elements\n- optional support for [hofff/contao-content-navigation](https://github.com/hofff/contao-content-navigation)\n\n## Usage\n\n### Setup\n\n1. Install with composer or contao manager\n\n        composer require heimrichhannot/contao-news-pagination-bundle\n\n1. Update database\n1. You'll find new configuration options in the news reader frontend module or your reader configuration\n1. Add `\u003c?= $this-\u003enewsPagination ?\u003e` to your details template (e.g. \"news_full\") to output the pagination navigation\n\n### Known limitations for automatic pagination\n\n- currently only ce_text not nested in another content element (like an accordion) is supported for splitting, other elements are removed properly according to current page number though (completely)\n\n## Developers\n\n### PaginationUtil\n\nThe script to do the automatic pagination can be used by developers by using the `PaginationUtil`.\n\nExample:\n\n```php\nuse HeimrichHannot\\NewsPaginationBundle\\Util\\PaginationUtil;\nuse Wa72\\HtmlPageDom\\HtmlPageCrawler;\n\nclass ParseArticlesListener {\n    /** @var PaginationUtil */\n    protected $paginationUtil;\n    \n    public function __invoke(FrontendTemplate $template, array $newsEntry, Module $module) {\n        $result = $this-\u003epaginationUtil-\u003epaginateHtmlText($template-\u003etext, 500, 1, [\n                'selector' =\u003e '.ce_text_custom div.text',\n                'removePageElementsCallback' =\u003e function (array $result, int $currentPage, int $page) {\n                    // Always show page 1\n                    if (1 === $page) {\n                        return false;\n                    }\n                    // Insert custom html after page 3\n                    if (3 === $page) {\n                        $someCustomInsertion = new HtmlPageCrawler('\u003cdiv class=\"alert\"\u003eCustom Notice!\u003c/div\u003e');\n                        $someCustomInsertion-\u003einsertAfter(end($result[$page])['element']);\n                    }\n                    // Remove all element not on the current page (default)\n                    return $page != $currentPage;\n                }\n            ]);\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-news-pagination-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheimrichhannot%2Fcontao-news-pagination-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-news-pagination-bundle/lists"}