Hi,
danke für die Hilfe. Ich habe den Code mal getestet. Es wird überhaupt kein Artikel angezeigt. Pagination und Kategorien-Sortierung demzufolge auch nicht. Irgendwo muss da wohl noch ein Fehler stecken.
Gruss, Nicki
##
# Konfiguration:
$perpage = 5; #This number specified how many lines to show on a page.
##
# Programm:
$data=array(); # neu
$_GET['tg']=trim($_GET['tg']);
$lines = file($_SERVER['DOCUMENT_ROOT']."/posts/".date("Y").".txt"); # This is your text file.
foreach ($lines as $line) {
$line=trim($line);
if ( $line and '#' != $line{0} ) {
$data=explode("|", $lines[$i], 5);
}
}
foreach ($data as $tupel) {
if ($tupel[4]==$_GET['tg']) {
echo '<div class="post-preview">',
'<a href="post.html?q=',
urlencode($tupel[1]),
'&title=', urlencode($tupel[2]),
'&sub=', urlencode($tupel[3]),
'&date=', urlencode($tupel[0]),
'"><h2 class="post-title">,
'.urldecode($tupel[2]),
'</h2></a>',
'<h3 class="post-subtitle">', urldecode($tupel[3]), '</h3>',
'<p class="post-meta">Posted by <a href="#">Me</a> on '.urldecode($tupel[0]), '</p>',
'</div>',
'<hr />';
}
}
$total_pages = $line_amount/$perpage;
if($line_amount % $perpage != 0){
$total_pages = $total_pages + 1;
}
if($p <= $total_pages - 1){
$next_page=$p+1;
echo "<ul class=\"pager\">";
echo "<li class=\"next\">";
echo "<a rel='next' href='?p=$next_page'>Next</a>";
echo "</li>";
echo "</ul>";
}
if($p!=1)
{
$back_page=$p-1;
echo "<ul class=\"pager\">";
echo "<li class=\"next\">";
echo "<a rel='prev' href='?p=$back_page'>Back</a>";
echo "</li>";
echo "</ul>";
}