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   3225 Views

Avatar
biapar

Forum Moderator, 435 Posts

7 December 2010 at 9:04pm

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

Forum Moderator, 5513 Posts

8 December 2010 at 11:34am

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

Avatar
biapar

Forum Moderator, 435 Posts

9 December 2010 at 2:47am

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

Community Member, 41 Posts

22 December 2010 at 10:18am

Hi biapar,

$Parent.Link() should do it.

chao
Carlos

Avatar
biapar

Forum Moderator, 435 Posts

5 January 2011 at 2:37am

It works. Thank you