entries_per_page is working now

This commit is contained in:
Stefan Ritter 2009-03-02 01:50:14 +01:00
parent 90abea32b6
commit 6ec1a0bae9

View File

@ -35,11 +35,11 @@ action = cgi.FieldStorage()
month_display = action.getvalue('m') month_display = action.getvalue('m')
post_display = action.getvalue('p') post_display = action.getvalue('p')
static_display = action.getvalue('s') static_display = action.getvalue('s')
site_display = action.getvalue('i') allentries_display = action.getvalue('a')
if not month_display: month_display = "" if not month_display: month_display = ""
if not post_display: post_display = "" if not post_display: post_display = ""
if not static_display: static_display = "" if not static_display: static_display = ""
if not site_display: site_display = "" if not allentries_display: allentries_display = ""
print 'Content-type: text/html\n' print 'Content-type: text/html\n'
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
@ -115,11 +115,10 @@ else: # Show regular entry
entry = entry[1] entry = entry[1]
title = entry.replace('entries/', '', 1) title = entry.replace('entries/', '', 1)
title = title.replace('.txt', '') title = title.replace('.txt', '')
entry_counter += 1
if month_display == date_to_compare or not month_display: if month_display == date_to_compare or not month_display:
if post_display == title or not post_display: if post_display == title or not post_display:
if entry_counter <= entries_per_page: if allentries_display == "1" or entry_counter < entries_per_page:
content = open(entry, "r") content = open(entry, "r")
if permalinks: if permalinks:
print ' <div class="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>' print ' <div class="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>'
@ -131,9 +130,10 @@ else: # Show regular entry
print ' </p></div>' print ' </p></div>'
print ' <br /><br />' print ' <br /><br />'
content.close() content.close()
entry_counter += 1
if entry_counter > entries_per_page: # Display pagelist if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist
print ' <div class="entry"><a href=?>[previous page]</a> <a href=?>[next page]</a></div>' print ' <div class="entry"><a href=?a=1>View all entries...</a></div>'
print ' </div>' print ' </div>'
print ' </body>' print ' </body>'