Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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
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
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
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> · <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
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
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
#25 2007-08-15 15:09:12
- NicKy
- Member
- Registered: 2007-08-08
- Posts: 13
Re: How do i separate the comments from the article ?
i use
[request_uri] => /textpattern-4.0.5/article/1/comments/
[permlink_mode] => section_id_title
Last edited by NicKy (2007-08-15 15:12:49)
Offline
Re: How do i separate the comments from the article ?
Is ‘comments’ your article title?
Offline
#27 2007-08-15 20:20:45
- NicKy
- Member
- Registered: 2007-08-08
- Posts: 13
Re: How do i separate the comments from the article ?
[request_uri] => /textpattern-4.0.5/article/1/first-post/comments/
same result.
Last edited by NicKy (2007-08-15 20:20:54)
Offline
Re: How do i separate the comments from the article ?
If you put this just below the ‘extract’ line in the code, what does it show?:
dmp($u1);dmp($u2);dmp($u3);dmp($u4);
Last edited by ruud (2007-08-15 20:34:39)
Offline
#29 2007-08-17 07:53:12
- NicKy
- Member
- Registered: 2007-08-08
- Posts: 13
Re: How do i separate the comments from the article ?
NULL
NULL
NULL
NULL
Last edited by NicKy (2007-08-17 07:53:27)
Offline
Re: How do i separate the comments from the article ?
That’s strange… in that case clean urls would not work at all on your website. What does this show:
<txp:php>
global $pretext;
dmp($pretext['req']);
dmp(chopUrl($pretext['req']));
extract(chopUrl($pretext['req']));
dmp($u1);dmp($u2);dmp($u3);dmp($u4);
</txp:php>
Offline