mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 11:19:22 +02:00
commit
8566ee6b5c
@ -262,8 +262,13 @@
|
|||||||
// -------------- \\
|
// -------------- \\
|
||||||
// WEBSITE STUFF \\
|
// WEBSITE STUFF \\
|
||||||
// -------------- \\
|
// -------------- \\
|
||||||
|
|
||||||
|
// News to be displayed per page
|
||||||
|
$config['news_per_page'] = 4;
|
||||||
|
|
||||||
// Enable or disable changelog ticker in news page.
|
// Enable or disable changelog ticker in news page.
|
||||||
$config['UseChangelogTicker'] = true;
|
$config['UseChangelogTicker'] = true;
|
||||||
|
|
||||||
// Highscore configuration
|
// Highscore configuration
|
||||||
$config['highscore'] = array(
|
$config['highscore'] = array(
|
||||||
'rows' => 100,
|
'rows' => 100,
|
||||||
|
60
index.php
60
index.php
@ -1,4 +1,11 @@
|
|||||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||||
|
|
||||||
|
if (!isset($_GET['page'])) {
|
||||||
|
$page = 0;
|
||||||
|
} else {
|
||||||
|
$page = (int)$_GET['page'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
|
if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
|
||||||
else {
|
else {
|
||||||
if ($config['UseChangelogTicker']) {
|
if ($config['UseChangelogTicker']) {
|
||||||
@ -32,7 +39,6 @@
|
|||||||
$cache = new Cache('engine/cache/news');
|
$cache = new Cache('engine/cache/news');
|
||||||
if ($cache->hasExpired()) {
|
if ($cache->hasExpired()) {
|
||||||
$news = fetchAllNews();
|
$news = fetchAllNews();
|
||||||
|
|
||||||
$cache->setContent($news);
|
$cache->setContent($news);
|
||||||
$cache->save();
|
$cache->save();
|
||||||
} else {
|
} else {
|
||||||
@ -41,6 +47,12 @@
|
|||||||
|
|
||||||
// Design and present the list
|
// Design and present the list
|
||||||
if ($news) {
|
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) {
|
function TransformToBBCode($string) {
|
||||||
$tags = array(
|
$tags = array(
|
||||||
'[center]{$1}[/center]' => '<center>$1</center>',
|
'[center]{$1}[/center]' => '<center>$1</center>',
|
||||||
@ -58,20 +70,40 @@
|
|||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
foreach ($news as $n) {
|
for ($i = $current; $i < $current + $config['news_per_page']; $i++) {
|
||||||
?>
|
if (isset($news[$i])) {
|
||||||
<table id="news">
|
?>
|
||||||
<tr class="yellow">
|
<table id="news">
|
||||||
<td class="zheadline"><?php echo getClock($n['date'], true) .' by <a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a> - <b>'. TransformToBBCode($n['title']) .'</b>'; ?></td>
|
<tr class="yellow">
|
||||||
</tr>
|
<td class="zheadline"><?php echo getClock($news[$i]['date'], true) .' by <a href="characterprofile.php?name='. $news[$i]['name'] .'">'. $news[$i]['name'] .'</a> - <b>'. TransformToBBCode($news[$i]['title']) .'</b>'; ?></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>
|
<tr>
|
||||||
<p><?php echo TransformToBBCode(nl2br($n['text'])); ?></p>
|
<td>
|
||||||
</td>
|
<p><?php echo TransformToBBCode(nl2br($news[$i]['text'])); ?></p>
|
||||||
</tr>
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
<?php
|
</table>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo '<select name="newspage" onchange="location = this.options[this.selectedIndex].value;">';
|
||||||
|
|
||||||
|
for ($i = 0; $i < $page_amount; $i++) {
|
||||||
|
|
||||||
|
if ($i == $page) {
|
||||||
|
|
||||||
|
echo '<option value="index.php?page='.$i.'" selected>Page '.$i.'</option>';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
echo '<option value="index.php?page='.$i.'">Page '.$i.'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</select>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo '<p>No news exist.</p>';
|
echo '<p>No news exist.</p>';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user