Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

comment count tip

Last post 01-08-2008, 11:58 PM by DougJoseph. 23 replies.
Page 1 of 2 (24 items)   1 2 Next >
Sort Posts: Previous Next
  •  01-03-2008, 2:26 PM 38126

    comment count tip

    I've been working with the new chicago template on my blog and found a workaround for something that was bugging me.

    In the footer where I display article information such as article rss feed, last updated date and comment count, my template originally looked like this

    [rss logo]  | updated:  $_article_edited  | $_comment_count

    ...and that looks good while comments are open but if the commenting period expires and no comments were entered, Vine Type will return nothing for $_formatted_comment_count making the output look like this

    [rss] | updated: 15 Nov 2007 |

    and that "|" at the end was bugging me.  So I removed the bar from the template and changed the vinetype.config file for the formatted comment count to look like this:

    $formatted_comment_0: | awaiting first comment

    $formatted_comment_1: | $_comment_count comment

    $formatted_comment_2: | $_comment_count comments

    and the config file like this

     [rss logo]  | updated:  $_article_edited  $_comment_count

    putting the bar into the config file.  Now if articles close without comments, no bar appears after the date.

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under: ,
  •  01-04-2008, 1:45 AM 38160 in reply to 38126

    Re: comment count tip

    Nice. Will look to implement this.
    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 3:57 AM 38164 in reply to 38126

    Re: comment count tip

    For me, this:

    [rss logo]  | updated:  $_article_edited  | $_comment_count

    ...had to be this: 

    [rss logo]  | updated:  $_article_edited  | $_formatted_comment_count

    Also, for me, this:

    $formatted_comment_0

    ...had to be this:

    $formatted_comment_count0

    (and so forth).

    Also, I'd love to have separate links for letting people click to view comments, and letting people click to make comments (because in a page listing many articles, the comments and form are not always visible).

    Currently the only thing hindering me from doing that is a way to reference the given article's ID in the Vinetype config file.

    If something like $_article_id would work in the config file, I could go to town. But trying it seems to break the site.

    As it stands now, when I try to code separate links to both the article's comments and its comment form, I'm having to code in the template, which offers some problems.

    Ideally, my goal would be to have a link to "view X comment(s)" that appears once there are some, and disappears if there are none, and also a link to "add a comment" that appears when commenting is available and disappears once the comment period is closed.

    But I know I'm being picky.  :-)


    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 11:16 AM 38174 in reply to 38164

    Re: comment count tip

    DougJoseph:

    For me, this:

    [rss logo]  | updated:  $_article_edited  | $_comment_count

    ...had to be this: 

    [rss logo]  | updated:  $_article_edited  | $_formatted_comment_count

    Also, for me, this:

    $formatted_comment_0

    ...had to be this:

    $formatted_comment_count0

    (and so forth).

     

    Oops. Yes, your syntax is correct and mine is not.  Good catch.  I had the concept but not the execution.  :-) 

    DougJoseph:

    Currently the only thing hindering me from doing that is a way to reference the given article's ID in the Vinetype config file.

    If something like $_article_id would work in the config file, I could go to town. But trying it seems to break the site.

    There's only one configuaration file, which article id would $_article_id represent?  When there are more than one on a page, what would $_article_id be?  What would $_article_id be for search results?  

    $_article_id is only meaningful inside the < article > area of a template since it represents a unique article. 

     

    DougJoseph:

    As it stands now, when I try to code separate links to both the article's comments and its comment form, I'm having to code in the template, which offers some problems.

    I understand your dilemma... 

    DougJoseph:

    Ideally, my goal would be to have a link to "view X comment(s)" that appears once there are some, and disappears if there are none, and also a link to "add a comment" that appears when commenting is available and disappears once the comment period is closed.

    But I know I'm being picky.  :-)

    I think this can be done in the template and with some CSS magic.  Warning: the following is conceptual and may contain syntax errors. :-)

    If you put this into the template file < article > section 

    [rss logo]  | updated:  $_article_edited  < span class="cmnts$_comment_count" >| < a href="$_aspx_section & amp;id=$_article_id#commentdiv">view $_formatted_comment_count </a>< /span > 

    and this into your CSS file

    .cmnts0 { display: none }

     
    Then the  link would only appear when comment count > 0

     

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under:
  •  01-04-2008, 12:14 PM 38178 in reply to 38174

    Re: comment count tip

    carlcamera:
    DougJoseph:

    Currently the only thing hindering me from doing that is a way to reference the given article's ID in the Vinetype config file.

    If something like $_article_id would work in the config file, I could go to town. But trying it seems to break the site.

    There's only one configuaration file, which article id would $_article_id represent?  When there are more than one on a page, what would $_article_id be?  What would $_article_id be for search results?  

    $_article_id is only meaningful inside the < article > area of a template since it represents a unique article. 

    Sorry for not making myself clear. I was not meaning to define an ID value for the var in the config file, but meaning that I could use the var inside another var in the config file, and that when it (the containing var) got used in a template, then the VineType DLL would see the ID var getting dropped into the template because of the containing var containing it, and assign it an ID value on the fly, as normal, at the time of execution. That's why I used the language of "referencing" the ID (as opposed to defining it). Again, sorry for not being more clear.


    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 12:18 PM 38179 in reply to 38174

    Re: comment count tip

    carlcamera:
    DougJoseph:

    Ideally, my goal would be to have a link to "view X comment(s)" that appears once there are some, and disappears if there are none, and also a link to "add a comment" that appears when commenting is available and disappears once the comment period is closed.

    But I know I'm being picky.  :-)

    I think this can be done in the template and with some CSS magic.  Warning: the following is conceptual and may contain syntax errors. :-)

    If you put this into the template file < article > section 

    [rss logo]  | updated:  $_article_edited  < span class="cmnts$_comment_count" >| < a href="$_aspx_section & amp;id=$_article_id#commentdiv">view $_formatted_comment_count </a>< /span > 

    and this into your CSS file

    .cmnts0 { display: none }


    Then the  link would only appear when comment count > 0

    More brilliance from Carl Camera. I know I'll probably never know your product as well as its creator, but eventually I hope to start remembering that plain old CSS, when combined with certain vars in the VineType templates, can be used to hide stuff and show stuff. I'll be implementing this soon. Thanks!


    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 1:01 PM 38185 in reply to 38174

    Re: comment count tip

    Couple more quick questions on this.

    I think I need a little more understanding on how the two processes of displaying comments and soliciting comments are intended to work in Vinetype.

    I got from your helpful tip above, how to hide a "view (comments)" link when there are no comments. (Look to the comment count var.) But... the $_formatted_comment_count var seems to not show any content when the comment period is closed. (?) I think I'm wanting to display the assigned value for $_formatted_comment_count, but only if it is above zero, and regardless of whether the comment period is closed. This meaning, I want folks to be able to read gleaned comments even after the comment period is closed. That's doable, right?

    Secondly, which var would I look to in order to hide an "add a comment" link when the comment period is closed? Honestly, it seems currently that $_formatted_comment_count is somehow being used in this way (linked to the closing of the comment period), and if that's the case, then I cannot differenciate between displaying comments and soliciting comments if $_formatted_comment_count is going to be disappearing after the closing of the comment period (but while I was yet still want to display the comments gleaned before the period was closed).

    I'm sorry if I missed this in the Vinetype reference area. I searched but did not find what I was looking for. Thanks if you can help!


    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 1:08 PM 38186 in reply to 38178

    Re: comment count tip

    DougJoseph:
    carlcamera:
    DougJoseph:

    Currently the only thing hindering me from doing that is a way to reference the given article's ID in the Vinetype config file.

    If something like $_article_id would work in the config file, I could go to town. But trying it seems to break the site.

    There's only one configuaration file, which article id would $_article_id represent?  When there are more than one on a page, what would $_article_id be?  What would $_article_id be for search results?  

    $_article_id is only meaningful inside the < article > area of a template since it represents a unique article. 

    Sorry for not making myself clear. I was not meaning to define an ID value for the var in the config file, but meaning that I could use the var inside another var in the config file, and that when it (the containing var) got used in a template, then the VineType DLL would see the ID var getting dropped into the template because of the containing var containing it, and assign it an ID value on the fly, as normal, at the time of execution. That's why I used the language of "referencing" the ID (as opposed to defining it). Again, sorry for not being more clear.

    Ahhh.  I see. Yes, this gets down to the technical implementation of how "stuff" gets replaced during the processing of a page.  Articles are processed first (including $_article_id) then all the other "stuff" (navigation, user variables, etc.) are processed separately.  The current architecture does not allow for this -- but I have thought of a way to re-architect it where it would work.  What is missing right now is re-architecture motivation, if you know what I mean. :-)

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under:
  •  01-04-2008, 1:11 PM 38187 in reply to 38179

    Re: comment count tip

    DougJoseph:

    I know I'll probably never know your product as well as its creator, but eventually I hope to start remembering that plain old CSS, when combined with certain vars in the VineType templates, can be used to hide stuff and show stuff. I'll be implementing this soon. Thanks!

    Thanks for bringing this up.  I'm glad I could help.

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under: ,
  •  01-04-2008, 1:21 PM 38188 in reply to 38187

    Re: comment count tip

    This is just a "bump" post. Right while you were replying to me, I was editing my post above this one. #38185. I just wanted to catch your attention, to notice it was just updated.
    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 1:28 PM 38189 in reply to 38185

    Re: comment count tip

    I'll take this one at a time... 

    DougJoseph:

    But... the $_formatted_comment_count var seems to not show any content when the comment period is closed. (?) I think I'm wanting to display the assigned value for $_formatted_comment_count, but only if it is above zero, and regardless of whether the comment period is closed. This meaning, I want folks to be able to read gleaned comments even after the comment period is closed. That's doable, right?

    $_formatted_comment_count will continue to display after the comment period closes if comments were added.

    In other words, it only hides itself when the period is over and no comments were left.  So I think this is behaving the way you want it to.  ie  the link "view 7 comments" will continue to appear after the commenting period expires.


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under:
  •  01-04-2008, 1:39 PM 38192 in reply to 38185

    Re: comment count tip

    DougJoseph:

    Secondly, which var would I look to in order to hide an "add a comment" link when the comment period is closed? Honestly, it seems currently that $_formatted_comment_count is somehow being used in this way (linked to the closing of the comment period), and if that's the case, then I cannot differenciate between displaying comments and soliciting comments if $_formatted_comment_count is going to be disappearing after the closing of the comment period (but while I was yet still want to display the comments gleaned before the period was closed).

    Perhaps we need a template variable to indicate whether the commenting period has expired.  Something like $_accepting_comments with values "yes" or "no" ?

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under:
  •  01-04-2008, 2:25 PM 38196 in reply to 38189

    Re: comment count tip

    That would be great.

    PS: I'm having trouble getting the CSS trick to hide. The name of the var is being written out to the page, instead of the value. I must have the variable name mispelled or something.


    Sincerely,
    Doug Joseph
    Filed under:
  •  01-04-2008, 2:47 PM 38198 in reply to 38196

    Re: comment count tip

    Re: the CSS hiding trick

    Help! I cannot get the variable's value to be written to the page! It keeps writing the variable's name instead!

    When I put this in the template:

    <span class="cmnts$_comment_count">

    ... I get this when the page is written (view > source):

    <span class="cmnts$_comment_count">

    ... instead of this

    <span class="cmnts0"> OR <span class="cmnts2"> OR <span class="cmnts8">

    I also tried it with a space in front. I think next I'll try with carriage returns above and below the var.


    Sincerely,
    Doug Joseph
  •  01-04-2008, 2:52 PM 38199 in reply to 38198

    Re: comment count tip

    Nope, it does not work with carriage returns in the template above and below the var name either.

    I cannot figure out why I cannot retrieve the value of  $_comment_count when used in the template.

    I have double checked the spelling. I think it is right. Can you see if this is working on your end?


    Sincerely,
    Doug Joseph
Page 1 of 2 (24 items)   1 2 Next >
View as RSS news feed in XML