Gossamer Forum
Home : Products : Gossamer Links : Discussions :

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

Quote Reply
Re: [Matthias70] Latest posts from wordpress on home.html In reply to
You probably want <%comment_post_ID%> for the post ID (not sure how you link it to WP, but that should be enough to do so)

Quote:
1. I have no access to the post title and the post url, which should be on top of the comment content.

You would need to somehow get the blog post title from the "wp_post" table, but without knowing the field names, wouldn't be able to help you there. Should be as simple as something like:

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 10|;

my $sth = $dbh->prepare($query) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;

my @loop
while (my $hit = $sth->fetchrow_hashref) {
$hit->{post_title} = get_title($hit->{comment_post_ID});
push @loop, $hit;

}

$sth->finish();
$dbh->disconnect();

return { get_latest_comments => \@loop }

sub get_title {
my $sth = $dbh->prepare(qq|SELECT post_title FROM ${prefix}posts WHERE post_id = $_[0]|) || die $DBI::errstr;
$sth->execute() || die $DBI::errstr;
return sth->fetchrow;
}


}

Cheersw

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
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 17400 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 17385 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 17318 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 6551 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