mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 11:19:22 +02:00
You can now view a specific news post with the view=postid URL GET param, or click the published date of the post.
This commit is contained in:
parent
6c036b0a1b
commit
138f03ce99
40
index.php
40
index.php
@ -6,6 +6,7 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
|
|||||||
} else {
|
} else {
|
||||||
$page = (int)$_GET['page'];
|
$page = (int)$_GET['page'];
|
||||||
}
|
}
|
||||||
|
$view = (isset($_GET['view'])) ? (int)$_GET['view'] : 0;
|
||||||
|
|
||||||
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 {
|
||||||
@ -72,12 +73,46 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
|
|||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($view > 0) { // We want to view a specific news post
|
||||||
|
$si = false;
|
||||||
|
for ($i = 0; $i < count($news); $i++) if ($view === (int)$news[$i]['id']) $si = $i;
|
||||||
|
if ($si !== false) {
|
||||||
|
?>
|
||||||
|
<table id="news">
|
||||||
|
<tr class="yellow">
|
||||||
|
<td class="zheadline"><?php echo getClock($news[$si]['date'], true) .' by <a href="characterprofile.php?name='. $news[$si]['name'] .'">'. $news[$si]['name'] .'</a> - <b>'. TransformToBBCode($news[$si]['title']) .'</b>'; ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p><?php echo TransformToBBCode(nl2br($news[$si]['text'])); ?></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<table id="news">
|
||||||
|
<tr class="yellow">
|
||||||
|
<td class="zheadline">News post not found.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p>We failed to find the post you where looking for.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // We want to view latest news or a page of news.
|
||||||
|
|
||||||
for ($i = $current; $i < $current + $config['news_per_page']; $i++) {
|
for ($i = $current; $i < $current + $config['news_per_page']; $i++) {
|
||||||
if (isset($news[$i])) {
|
if (isset($news[$i])) {
|
||||||
?>
|
?>
|
||||||
<table id="news">
|
<table id="news">
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<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>
|
<td class="zheadline"><?php echo '<a href="?view='.$news[$i]['id'].'">'.getClock($news[$i]['date'], true).'</a> by <a href="characterprofile.php?name='. $news[$i]['name'] .'">'. $news[$i]['name'] .'</a> - <b>'. TransformToBBCode($news[$i]['title']) .'</b>'; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -89,7 +124,6 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<select name="newspage" onchange="location = this.options[this.selectedIndex].value;">';
|
echo '<select name="newspage" onchange="location = this.options[this.selectedIndex].value;">';
|
||||||
|
|
||||||
for ($i = 0; $i < $page_amount; $i++) {
|
for ($i = 0; $i < $page_amount; $i++) {
|
||||||
@ -106,6 +140,8 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
|
|||||||
|
|
||||||
echo '</select>';
|
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