Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2012-09-20 11:36:18

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: rah_comments // Pagination for comments

Hello.

Jukka, very nice plugin. I using this plugin in my new project and is very helpful.

But for my project I have made a little hack at rah_recent_comments that allow exctrat recent comment from a single article by simple adding one attribute.

Extra attribute (put in below line 13)

'article_id' => ''

Adding a check and mod at mysql query (put in below line18)

$article_id=(!empty($article_id))?' t.ID='.$article_id.' and':'';
		$rs = startRows('select d.name, d.message, d.posted, d.parentid, d.discussid, t.ID as thisid, unix_timestamp(t.Posted) as posted, t.Title as title, t.Section as section, t.url_title '.'from '. safe_pfx('txp_discuss') .' as d inner join '. safe_pfx('textpattern') .' as t on d.parentid = t.ID '.'where'.$article_id.' t.Status >= 4 and d.visible = '.VISIBLE.' order by '.doSlash($sort).' limit 0,'.intval($limit));

So, if I show in article list for example the last comment of one article I can use this function!

Another info.
The rah_comment_pglink function use this value

$thiscomment['pglink']=permlinkurl($c).$sep.'pg='.$pg.'#c'.(int)$c['discussid'];
but the function (int) remove all zero of discussid and will not link at correct anchor.

Last edited by MarcoK (2012-09-20 11:38:14)

Offline

#92 2012-09-20 13:19:38

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: rah_comments // Pagination for comments

MarcoK wrote:

So, if I show in article list for example the last comment of one article I can use this function

If you just want a comment from a specific article, you don’t really need plugins for that. You can show comments from any specific article with a article_custom tag, combined with the standard comments. E.g.

<txp:article_custom id="533">
	<txp:comments limit="1" />
</txp:article_custom>

Since the comments tag works in any article context, not just on the article page, the above would show a comment from the article of ID 533.

but the function (int) remove all zero of discussid and will not link at correct anchor.

Yeah, the link is probably incorrect since comments use padded zerofill IDs. Good call. Have honestly never really used the bundled recent comments tag, so I have had no clue about the issue. Haven’t even really touched this thing in ages at all.

I’ve actually tried to researched better ways to do generic dynamic pagination in Textpattern, and a comment pagination that could be built using other, more customizable tags. This whole pagination thing is nothing special after all, just few populated attributes (limit, offset) passed to the comments tag.

Last edited by Gocom (2012-09-20 13:21:53)

Offline

#93 2012-09-20 16:27:23

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: rah_comments // Pagination for comments

Gocom wrote:

If you just want a comment from a specific article, you don’t really need plugins for that. You can show comments from any specific article with a article_custom tag, combined with the standard comments. E.g.

Yeah, I know this method. But unfortunately it is not what I want to achieve.
I don’t wont show the last comment into an article list, but a link to last comment.

For example think an article list showed as:

Author:               Title:                           Last Comment:
Mr. Smith       The new plugin           Mr.Brown at 19/09/2012 18:50

In this case, i can’t use <txp:comments limit="1" /> becouse it link without paginating comments.

is the same reason that you have made rah_recent_comments!
And if I use rah_recent_comments I obtain the last comment of all articles not of the individual.

Last edited by MarcoK (2012-09-20 16:27:53)

Offline

#94 2015-03-10 05:21:43

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: rah_comments // Pagination for comments

How to assign CSS class or id for current page number pagination area ?
i mean assigning class for active (current)

Last edited by raminrahimi (2015-03-10 10:02:54)

Offline

Board footer

Powered by FluxBB