diff --git a/config.php b/config.php index 2d9a4e5..d2556b5 100644 --- a/config.php +++ b/config.php @@ -200,8 +200,13 @@ // -------------- \\ // WEBSITE STUFF \\ // -------------- \\ + + // News to be displayed per page + $config['news_per_page'] = 4; + // Enable or disable changelog ticker in news page. $config['UseChangelogTicker'] = true; + // Highscore configuration $config['highscore'] = array( 'rows' => 100, diff --git a/index.php b/index.php index 94848c5..dc9d0e8 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,11 @@ hasExpired()) { $news = fetchAllNews(); - $cache->setContent($news); $cache->save(); } else { @@ -41,6 +47,12 @@ // Design and present the list if ($news) { + + $total_news = count($news); + $row_news = $total_news / $config['news_per_page']; + $page_amount = ceil($total_news / $config['news_per_page']); + $current = $config['news_per_page'] * $page; + function TransformToBBCode($string) { $tags = array( '[center]{$1}[/center]' => '
'. $n['name'] .' - '. TransformToBBCode($n['title']) .''; ?> | -
- - | -
'. $news[$i]['name'] .' - '. TransformToBBCode($news[$i]['title']) .''; ?> | +
+ + | +
No news exist.
'; }