Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Link to post from comment...


Reply

5 Posts   3172 Views

Avatar
biapar

7 December 2010 at 9:04pm Forum Moderator, 435 Posts

Hi,

How create link from comment to post?
Because I've create function that listing latest comments from blog...

This is code:

function LatestComments() {
$member = Member::currentUser();
//if(!$member) return false;
//$comments = DataObject::get("PageComment", "AuthorID = '$member->ID'","Created DESC","",10);
$comments = DataObject::get("PageComment",null,"Created DESC","",10);
return $comments;
}

Thanks

Avatar
Willr

8 December 2010 at 11:34am Forum Moderator, 5511 Posts

In the template you can simply call $Link to get a link to the specific comment just like you do with pages.

Avatar
biapar

9 December 2010 at 2:47am Forum Moderator, 435 Posts

Thanks,

I tried. I wrote

<p class="commento"><a href="$Link" title="$Title.XML" class="$LinkingMode">$Comment.XML</a></p>

but link don't works becasue I've as result:

http://red-web-projects/PhPSites/xyz/#PageComment_6

Why?

Avatar
carlos

22 December 2010 at 10:18am Community Member, 41 Posts

Hi biapar,

$Parent.Link() should do it.

chao
Carlos

Avatar
biapar

5 January 2011 at 2:37am Forum Moderator, 435 Posts

It works. Thank you