Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [Andy] Latest posts from wordpress on home.html

Quote Reply
Re: [Andy] Latest posts from wordpress on home.html In reply to
Hi Andy,
O.K. now I have an output.
Have a look at http://www.gpaed.de/g-comments

But I have two problems.
1. I have no access to the post title and the post url, which should be on top of the comment content.
2. I don't want to display the whole comment, just a few words?


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}comments ORDER BY comment_date 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 { latest_wordpress_comments => \@loop }

}

Code:
<%latest_wordpress_comments%>
<%loop latest_wordpress_comments%>
<p><a href="<%guid%>"><%comment_content%></a><br />
<%endloop%>

Matthias
gpaed.de
Subject Author Views Date
Thread Latest posts from wordpress on home.html Matthias70 18199 Jul 20, 2008, 1:30 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17807 Jul 20, 2008, 2:36 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17739 Jul 20, 2008, 2:54 AM
Post Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17764 Jul 20, 2008, 2:54 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17755 Jul 20, 2008, 6:30 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17734 Jul 20, 2008, 8:11 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Matthias70 17757 Jul 20, 2008, 8:15 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17735 Jul 20, 2008, 9:04 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17751 Jul 20, 2008, 9:50 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Matthias70 17769 Jul 29, 2008, 6:53 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17671 Jul 29, 2008, 7:57 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17740 Jul 29, 2008, 8:12 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Matthias70 17713 Oct 16, 2008, 2:30 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17693 Oct 16, 2008, 2:32 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
hegu 17401 May 17, 2009, 6:54 AM
Thread Re: [hegu] Latest posts from wordpress on home.html
Andy 17406 May 17, 2009, 9:00 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17386 May 17, 2009, 11:55 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17421 May 17, 2009, 11:36 PM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17412 May 18, 2009, 9:54 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17388 May 18, 2009, 10:03 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17319 May 18, 2009, 10:32 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17367 May 18, 2009, 10:40 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 17382 May 18, 2009, 10:57 AM
Post Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17247 May 18, 2009, 11:52 PM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 17305 May 18, 2009, 11:58 PM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 6976 May 19, 2009, 9:51 AM
Post Re: [Matthias70] Latest posts from wordpress on home.html
Andy 6987 May 19, 2009, 9:53 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 6981 May 19, 2009, 10:23 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Matthias70 6552 May 31, 2013, 3:50 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 6514 May 31, 2013, 8:18 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 6411 Jun 1, 2013, 1:35 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 6362 Jun 1, 2013, 2:17 AM
Thread Re: [Andy] Latest posts from wordpress on home.html
Matthias70 6473 Jun 1, 2013, 2:29 AM
Thread Re: [Matthias70] Latest posts from wordpress on home.html
Andy 6368 Jun 1, 2013, 2:40 AM
Post Re: [Andy] Latest posts from wordpress on home.html
Matthias70 6395 Jun 1, 2013, 2:47 AM