Hi Andy,
here is the code I'm using for the latest 5 wordpress post.
I marked the post related parts in
red Code:
sub {
my $prefix = 'wp_';
use DBI;
my $dbh = DBI->connect('DBI:mysql:*******', '*******', '*******'
) || die "Could not connect to database: $DBI::errstr";
my $query = qq|SELECT * FROM ${prefix}
posts WHERE
post_parent < 1 AND
post_status = 'publish' ORDER BY ID DESC LIMIT 5|;
my $sth = $dbh->prepare($query) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
$sth->finish();
$dbh->disconnect();
return { blog_loop => \@loop }
}
Code:
<%latest_wordpress%>
<%if blog_loop.length%>
<%loop blog_loop%>
<p><b><a href="<%guid%>"><%
post_title%></a></b><br />
<%endloop%>
I have sent you a gif attachment with the wordpress database field for the comments
Perhaps you can tell me the important field, so I can play around a little bit...
Matthias
gpaed.de