Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#85 2010-07-18 22:34:41

jan
Member
From: Utrecht, The Netherlands
Registered: 2006-08-31
Posts: 71
Website

Re: rah_comments // Pagination for comments

Hey,

Plugin was just what I needed, comments were breaking out of my design!

I have one suggestion: adding an attribute to control wheter or not the current page number is displayed as a link or as plain text.
It’s usually more helpful to display the current page as plain text, since it gives the user a direct indication of current page.

It requires two extra lines of code:

Extra attribute (put in below line 32)

'link_to_current' => 0,

Extra if clause to output either plaint text or link (replace line 50 with this longer version)

$number[] = (($link_to_current && $pg == $i) || $pg != $i) ? doTag($i,'a','page-'.$i,' href="'.permlink(array()).$sep.'pg='.$i.'"') : $i;

Cheers!


Kensington TXP powered rock

Offline

#86 2010-07-18 23:38:28

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

Re: rah_comments // Pagination for comments

Thank you for sharing, Jan :-)

Offline

#87 2010-09-07 07:55:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: rah_comments // Pagination for comments

is there a way to NOT have the pagination links when there is just one page of comments?

ps. Jukka, you may want to update the original post so as to state the latest 0.4 version of the plugin.

Last edited by colak (2010-09-07 08:18:25)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#88 2010-09-07 10:16:33

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

Re: rah_comments // Pagination for comments

colak wrote:

ps. Jukka, you may want to update the original post so as to state the latest 0.4 version of the plugin.

Thanks, Yiannis. Done.

is there a way to NOT have the pagination links when there is just one page of comments?

Is. From the docs:

showalways
Always show page number links, even if there is only a one page.
Default: showalways="1" (yes) Example: "" (no).

Following should work:

<txp:rah_comments showalways="0" />

Last edited by Gocom (2010-09-07 10:17:05)

Offline

#89 2010-09-07 10:20:31

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: rah_comments // Pagination for comments

Gocom wrote:

From the docs:

I’m blind as a bat! Thanks Jukka


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#90 2011-02-16 22:54:39

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 390

Re: rah_comments // Pagination for comments

Hello:

first of all, nice plugin! but I can’t use because it don’t recognizes de URL of my comments article page. It is not a error or bug, I explain:

At one site I’m spliting de article page in to different “pages”:

mysite.com/myarticle : an article wich shows its title, excerp, body… and only the 3 recent comments posted on the article.
mysite.com/myarticle?x=comments : with this param, the page show only the complete comments list on the article.

I want to use rah_comments in the comments version of the article page mysute.com/myarticle?x=comments, but the pagination bottons generated by rah_comments links allways to mysite.com/myarticle?pg=2 (3,4…) so I suposse it assumes that it is allways used on the normal article page (and it is a normal behavior, but fails in my case) Maybe if the plugin do not asumes where is it used and looked to the actual URL of the page, everythink will runs ok.

I know it is a nos usual use of comments, but I think that improve de plugin at this point will make it powerfull and don’t becomes it more complicated to the user.

Another improvement will be set de page 1 link go to “current page” (now articles permlink) without “?pg=1”. because it create duplicated content: two URLs serving de same information.

Last edited by milosevic (2011-02-16 23:10:04)


<txp:rocks/>

Offline

#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: 276

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