Page 1 of 1

Linear/Threaded line only visible when there are comments

Posted: Sun Nov 11, 2007 2:19 pm
by Janine
The code below shows the Title for the comments, if comments should be showed linear or threaded and the comments itself!

I want the line with which you can select linear or threaded to be visible only when there are comments. I tried to place the bold code within:

{if $entry.has_comments}
[bold code]
{/if}

But this doesnt work! Does anyone has a working solution?

Thank you,
Janine Ringers

Code: Select all

        
{if $is_single_entry and not $is_preview}
 <div class="serendipity_comments serendipity_section_comments">
 <a id="comments"></a>
 <div class="serendipity_commentsTitle">{$CONST.COMMENTS}</div>
 <div [b]class="serendipity_center">{$CONST.DISPLAY_COMMENTS_AS}
{if $entry.viewmode eq $CONST.VIEWMODE_LINEAR} ({$CONST.COMMENTS_VIEWMODE_LINEAR} | <a href="{$entry.link_viewmode_threaded}#comments" rel="nofollow">{$CONST.COMMENTS_VIEWMODE_THREADED}</a>)
{else}
 (<a rel="nofollow" href="{$entry.link_viewmode_linear}#comments">{$CONST.COMMENTS_VIEWMODE_LINEAR}</a> | {$CONST.COMMENTS_VIEWMODE_THREADED})[/b]
{/if}
 </div>{serendipity_printComments entry=$entry.id mode=$entry.viewmode}<br>

Re: Linear/Threaded line only visible when there are comment

Posted: Sun Nov 11, 2007 2:22 pm
by garvinhicking
Hi!

Hm, but what you wrote actually should work, yes.

For me, this here does the trick:

Code: Select all

{if $entry.comments > 0}
                <div class="serendipity_center">{$CONST.DISPLAY_COMMENTS_AS}
                {if $entry.viewmode eq $CONST.VIEWMODE_LINEAR}
                    ({$CONST.COMMENTS_VIEWMODE_LINEAR} | <a href="{$entry.link_viewmode_threaded}#comments" rel="nofollow">{$CONST.COMMENTS_VIEWMODE_THREADED}</a>)
                {else}
                    (<a rel="nofollow" href="{$entry.link_viewmode_linear}#comments">{$CONST.COMMENTS_VIEWMODE_LINEAR}</a> | {$CONST.COMMENTS_VIEWMODE_THREADED})
                {/if}
                </div>
{/if}
(Maybe using $entry.comments > 0 instead of $entry.has_comments is better. I don't remember if has_comments is maybe only used when comments are unmoderated, not only if there are more than 0 comments)

Regards,
Garvin

Posted: Sun Nov 11, 2007 2:26 pm
by Janine
Your solution works, thanks alot!

I love Serendipity!