Fork me on GitHub

Show number of EZComments on home page  Bottom

  • I am setting up EZComments on a PN .7.6.1 install. I would like to display the number of EZComments for each News article on the main index page like I did with the standard comment module...

    For that I used - - in the Xanthia template.

    How do I do this for EZComments?

    Eric
  • Eric,

    There was a topic on here a while back and jmvedrine provided some skeleton code for a pnRender plugin. It didn't work out of the box for me, but I was able to modify it to get it to work for my purposes with a recent CVS version of EZComments.

    I posted the plugin for download. You can get it from http://www.demeusy.c…download-cid-1.html

    Then, if you're using Xanthia, you can use something like the following which will result in a similar output to what you had using :

    Code

    <!--[nocache]--><a href="Article<!--[$info.sid]-->.html#comments">
    <!--[ezcommentscount sid=$info.sid assign=nbcomments]-->
    <!--[if $nbcomments eq 0]--><!--[pnml name="_COMMENTSQ"]-->
    <!--[elseif $nbcomments eq 1]--><!--[ezcommentscount sid=$info.sid]--> <!--[pnml name="_COMMENT"]-->
    <!--[else]--><!--[ezcommentscount sid=$info.sid]--> <!--[pnml name="_COMMENTS"]-->
    <!--[/if]-->
    </a>
    <!--[/nocache]-->


    Note: I am using shorturls, which is why I hard-coded the .html into the href tag. Not the most elegant solution, but it does the job.

    Hope that helps,
    -Matthew
  • I just noticed Mark's post that indicates that you don't really need this extra plugin, but can call the API directly from the template
    Read the thread here.
  • I was getting nothing but the number of comments... but I got your plugin solution to work...

    E
  • Correct - the API call will get you the number of comments... This allows you to format the output however you want... We didn't want to force you to have something of the form 'x comments'. A couple of simple examples...

    http://www.markwest.me.uk/changetheme-Gemini.phtml - in this theme i've just added the API call tag in brackets rather than having any wording around it. http://www.markwest.me.uk/Article38.phtml - here i've added some additional wording (add a string to your theme language file if required).

    In the second example you'll also notice that i've completed reworked how comments are displayed using a custom template set. With this release of EZComments you have complete control over how the commenting interface looks to the user and how comments are presented.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Could you please update your themes in the online-repository (CVS)?
    So that we could see, how you integrate the hooks?
    Would be very nice.
    Thanks.
  • Herr.Vorragend

    Could you please update your themes in the online-repository (CVS)?
    So that we could see, how you integrate the hooks?
    Would be very nice.
    Thanks.


    Sorry but if your post was aimed at me I don't know what you mean. My theme hasn't changed. The template set used for EZComments has however. You can create your own template set as needed.

    -Mark

    --
    Visit My homepage and Zikula themes.

This list is based on users active over the last 60 minutes.