aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-09-18 11:58:56 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-09-18 11:58:56 +0200
commit973edb08ed5ff35644328c244d5d584f44a70591 (patch)
tree864b7e74297fafa44db93ce5c55888380282de56 /t
parentb67acafd615ae705a3e3682f87f35027789ddda5 (diff)
downloadcforum-973edb08ed5ff35644328c244d5d584f44a70591.tar.gz
Implement `add' functions
Diffstat (limited to 't')
-rw-r--r--t/front.t18
-rw-r--r--t/user.t10
2 files changed, 25 insertions, 3 deletions
diff --git a/t/front.t b/t/front.t
index a12d712..9d39469 100644
--- a/t/front.t
+++ b/t/front.t
@@ -2,14 +2,26 @@
<h1><%= site.name %></h1>
<h3>Latest posts</h3>
<table border="1">
- <% while(post = nextpost(stmt)){
- user = getuser(byid("users", post->user)); %>
+ <% while(post = nextpost(pstmt)){
+ user = getuser(selectbyint("users", "oid", post->user)); %>
<tr>
<td><a href="?post=<% printf("%d", post->id); %>"><%= post->subject %></a></td>
<td><a href="?user=<% printf("%d", post->user); %>"><%= user->name %></a></td>
<td><% printdate(post->created); %></td>
</tr>
- <% free(post);
+ <% free(user);
+ free(post);
+ } %>
+</table>
+<h3>Latest users</h3>
+<table border="1">
+ <% while(user = nextuser(ustmt)){ %>
+ <tr>
+ <td><a href="?user=<% printf("%d", user->id); %>"><%= user->name %></a></td>
+ <td><%= user->full %></td>
+ <td><% printdate(user->created); %></td>
+ </tr>
+ <% free(user);
} %>
</table>
<% #include "foot.tc" %> \ No newline at end of file
diff --git a/t/user.t b/t/user.t
index af7c8cd..b69633a 100644
--- a/t/user.t
+++ b/t/user.t
@@ -1,3 +1,13 @@
<% #include "head.tc" %>
<h1>User <% printf("%d", id); %>: <%= user->name %></h1>
+<h3>Latest posts</h3>
+<table border="1">
+ <% while(post = nextpost(stmt)){ %>
+ <tr>
+ <td><a href="?post=<% printf("%d", post->id); %>"><%= post->subject %></a></td>
+ <td><% printdate(post->created); %></td>
+ </tr>
+ <% free(post);
+ } %>
+</table>
<% #include "foot.tc" %> \ No newline at end of file