Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2007-08-13 09:29:12

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How do i separate the comments from the article ?

Thank you, but … um, has anyone actually tested the code I posted?

Last edited by ruud (2007-08-13 09:36:23)

Offline

#14 2007-08-13 11:19:15

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: How do i separate the comments from the article ?

Absolutly ruud! That’s why I’m so enthousiasmed : works (very) fine!

Did you think about create a plugin to paginate comments?

Edit : can send you some Euros for that. :)

Last edited by Pat64 (2007-08-14 14:26:34)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#15 2007-08-13 12:12:35

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How do i separate the comments from the article ?

Send me an email ;)

Offline

#16 2007-08-13 20:17:40

jadehouse
Member
Registered: 2007-06-26
Posts: 75

Re: How do i separate the comments from the article ?

Ruud, if you do create a plugin for this please let me know. I’d be happy to pay for it.

Offline

#17 2007-08-14 12:10:11

NicKy
Member
Registered: 2007-08-08
Posts: 13

Re: How do i separate the comments from the article ?

im glad my thread is popular lol.

But i’m still confused, where should i put this code ?

Last edited by NicKy (2007-08-14 12:18:15)

Offline

#18 2007-08-14 13:41:27

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How do i separate the comments from the article ?

nicky, you can put that code in your template

And yes, I’ll probably turn this into a plugin, with an option for paginating comments.

Offline

#19 2007-08-14 14:02:38

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: How do i separate the comments from the article ?

NicKy wrote:

im glad my thread is popular lol. (…)

It seems it’s not a new demand. See on this subject, long times ago, the topic of Colak, Els and mine (and others)

Happy that ruud going to create a plugin :) … And I hope that Alistapart will choose TXP for its new website version (It would be an excellent promotion for TXP ;)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#20 2007-08-14 19:55:20

NicKy
Member
Registered: 2007-08-08
Posts: 13

Re: How do i separate the comments from the article ?

nicky, you can put that code in your template

What do you mean ? Section, page or form ?
And then, how do i do to link this new form to my articles ? (when i click on an article in go to this new form, same for comments)

Even if you make a plugin , i would like to understand, thanks ;)

Last edited by NicKy (2007-08-14 19:55:46)

Offline

#21 2007-08-14 20:12:51

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: How do i separate the comments from the article ?

Nicky,

As ruud explains :

1° create a section named “comment”
2° Copy your default template page and rename it “comment” (or another name as you want). Assign it to your corresponding section (see above)
3° Delete all your “default” content form and put into :

<txp:php>
  global $pretext;
  extract(chopUrl($pretext['req']));
  if ($u4 === 'comments') {
    echo parse('
        <txp:output_form form="comments_display" />
        <txp:output_form form="comment_form" />
    ');
  } else {
    echo parse('
       <txp:if_article_list>
       <h3><txp:permlink><txp:title /></txp:permlink> &#183; <txp:posted /></h3>
<txp:body />
<p>— <txp:author /></p>
<txp:comments_invite wraptag="p" /></txp:if_article_list>
    ');
  }
</txp:php>

4° Now, when you display your articles, you’ve got a link “add your comment” (assuming you’d changed the default invite within preferences tab). When you clic on it, all the comments are displaying in a separate page! Funny is’n it?

(Edit: changed code display to avoid wrong quotes display. -Els)

Last edited by els (2007-08-14 21:29:18)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#22 2007-08-14 21:18:45

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How do i separate the comments from the article ?

I meant in your page (I tend to call that a ‘template’ because it makes more sense to me).
So, you put the second bit of code (the smaller one) in your page and create two forms: one containing the tags for displaying the normal article, one containing tags for displaying the comments. All the PHP code does is decide which form to used based on the URL (if it ends in /comments, then it uses the comments_form).

Contrary to the explanation Patrick gives, you don’t need a separate comments section. You do need manually create a link on the article page that does <a href="<txp:permlink />/comments"</a>view comments</a>.

Last edited by ruud (2007-08-14 21:22:40)

Offline

#23 2007-08-15 12:28:36

NicKy
Member
Registered: 2007-08-08
Posts: 13

Re: How do i separate the comments from the article ?

$u4 is always empty for me :

print_r($pretext);
var_dump($u4);

result :

	Array
(
    [id] => 1
    [s] => article
    [c] => 
    [q] => 
    [pg] => 
    [p] => 
    [month] => 
    [author] => 
    [request_uri] => /textpattern-4.0.5/article/1/comments/
    [qs] => 
    [subpath] => \/textpattern-4\.0\.5\/
    [req] => /article/1/comments/
    [status] => 200
    [page] => archive
    [id_keywords] => 
    [id_author] => NicKy
    [next_id] => 
    [next_title] => 
    [next_utitle] => 
    [next_posted] => 
    [prev_id] => 
    [prev_title] => 
    [prev_utitle] => 
    [prev_posted] => 
    [path_from_root] => /textpattern-4.0.5/
    [pfr] => /textpattern-4.0.5/
    [path_to_site] => E:\Softwares\wamp\www\textpattern-4.0.5
    [permlink_mode] => section_id_title
    [sitename] => Mon site
    [secondpass] => 
)
NULL

Why ? :X

Last edited by NicKy (2007-08-15 12:29:21)

Offline

#24 2007-08-15 12:43:22

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How do i separate the comments from the article ?

Change that to $u3.
I assumed people were using /section/id/title URLs, but you seem to be using /section/id

Offline

Board footer

Powered by FluxBB