Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-02-27 13:07:45
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
comments and comments form on different pages.
Hello,
What I want is that under the article there are two links nl. display comments and enter comments.
If display comments are used only the comments are displayed without the form.
If enter comments are used then only the form and no comments are being displayed.
Can this be done easily.
Roelof
Offline
Re: comments and comments form on different pages.
Yea using jQuery collapsible div just group the form and the comments together,
so then when you view one of them it will hide the other.
Offline
#3 2010-02-28 11:55:41
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: comments and comments form on different pages.
Hello THE BLUE DRAGON,
Thank you for the tip.
I will try it.
Roelof
Offline
#4 2010-03-03 09:47:47
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: comments and comments form on different pages.
Hello The blue dragon.
I studied the pages and i don’t get it.
Is there a example where i can hide one div and the other div is displayed .
Roelof
Offline
Re: comments and comments form on different pages.
Download this script: animatedcollapse.js (taken from this page)
upload it to your server and add it between your <HEAD> tags:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/scripts/animatedcollapse.js">
/***********************************************
* Animated Collapsible DIV v2.4- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
Of course if you already include jQuery so you don’t need it, and just change the path to the animatedcollapse.js file.
(Remember to call the animatedcollapse.js after you call the jQuery!)
Also add this code to the head/your-js-file:
<script type="text/javascript">
animatedcollapse.addDiv('comments_form', 'fade=1,speed=400,group=txpcomments,hide=1')
animatedcollapse.addDiv('comments_display', 'fade=1,speed=400,group=txpcomments,hide=1')
animatedcollapse.init()
</script>
Now add this to your article form:
<txp:if_comments_allowed>
<!-- THE LINKS ON TOP -->
<div>
<a href="#" rel="toggle[comments_form]">Add a new comment</a>
<a href="#" rel="toggle[comments_display]">Display comments<txp:if_comments> (<txp:comments_count />)</txp:if_comments></a>
</div>
<!-- THE COMMENTS FORM AND PREVIEW -->
<div id="comments_form">
<txp:comments_preview />
<txp:comments_form />
</div>
<!-- THE COMMENTS DISPLAY -->
<div id="comments_display">
<txp:comments />
</div>
<txp:else />
Comments are turned off for this article.
</txp:if_comments_allowed>
Not tested, but should work.
Last edited by THE BLUE DRAGON (2010-03-03 13:01:00)
Offline
#6 2010-03-03 11:31:53
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: comments and comments form on different pages.
roelof wrote:
I studied the pages […]
Hm.
Always a good idea to look for demo/sample/example. But as there is much forest on that page, here’s a slightly clearer one.
Edit Ah, TBD was faster
Last edited by uli (2010-03-03 11:33:00)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#7 2010-03-03 12:38:13
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: comments and comments form on different pages.
Hello The Blue Dragon.
Sory, but it don’t work.
See this page: http://test.tamarawobben.nl/index.php?id=171#reactie
Roelof
Offline
Re: comments and comments form on different pages.
I don’t see any of the JS/jQuery code in your page.
Where are these:?
<script type="text/javascript" src="/scripts/animatedcollapse.js">...........
and
<script type="text/javascript">animatedcollapse.addDiv('comments_form'.........
BTW: Move the comments count from the “Add a new comment” to the “Display comments” link.
Last edited by THE BLUE DRAGON (2010-03-03 13:00:01)
Offline
#9 2010-03-03 13:09:49
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: comments and comments form on different pages.
Hello,
I changed it see :”
<src="http://test.tamarawobben.nl/js/animatedcollapse.js">
<script type="text/javascript">
animatedcollapse.addDiv('comments_form', 'fade=1,speed=400,group=txpcomments,hide=1')
animatedcollapse.addDiv('comments_display', 'fade=1,speed=400,group=txpcomments,hide=1')
animatedcollapse.init()
</script>
But still no go
Roelof
Offline
Re: comments and comments form on different pages.
I’m still don’t see the codes in this article: http://test.tamarawobben.nl/index.php?id=171#reactie
Offline
#11 2010-03-03 15:30:47
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: comments and comments form on different pages.
Oke,
My fault. This page uses the archive page and not the default page.
Changed that but still no luck.
Roelof
Offline
Re: comments and comments form on different pages.
You got a syntax error in:
<script type=“text/javascript” > < src=“http://test.tamarawobben.nl/js/animatedcollapse.js”>
Instead of:
<script type="text/javascript" src="http://test.tamarawobben.nl/js/animatedcollapse.js">
/***********************************************
* Animated Collapsible DIV v2.4- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
or:
<script type="text/javascript" src="http://test.tamarawobben.nl/js/animatedcollapse.js"></script>
Offline