Linear/Threaded line only visible when there are comments

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
Janine
Regular
Posts: 13
Joined: Tue Apr 03, 2007 8:48 am

Linear/Threaded line only visible when there are comments

Post 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>
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

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

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Janine
Regular
Posts: 13
Joined: Tue Apr 03, 2007 8:48 am

Post by Janine »

Your solution works, thanks alot!

I love Serendipity!
Post Reply