Jump to content



Recommended Posts

So I just want to do comments. I read http://processwire.com/api/fieldtypes/comments/ and this was a good starting point. I want full control of my markup and so <?php echo $page->comments->render();?> is not an option.

So I tried

  <ol id="singlecomments" class="commentlist">
   foreach($page->comments as $comment) {
   if($comment->status < 1) continue; // skip unapproved or spam comments
   $cite = htmlentities($comment->cite); // make sure output is entity encoded
   $text = htmlentities($comment->text);
   $date = date('d.m.Y', $comment->created); // format the date
                            <li class="clearfix">
                                <div class="message">
                                    <div class="info">
                                        <h2><a href=''><?=$cite?></a></h2>
                                        <div class="meta"><?=$date?></div><!-- /.meta -->
                                    </div><!-- /.info -->
                                </div><!-- /.message -->    
                       <?} ?>

And it's working finde. But:

1. I want to add Gravatars, how is the best practice?

2. I want to link $cite to the users website, but how can I achieve this?

3. I want at least paragraphs within $text, in a perfect world ul/ol and links, too.

Link to comment
Share on other sites

About Gravatar:

This is also pretty easy to do in PHP, just have a look at their documentation.

No need to request data from their API upfront, you can calculate a hash and assemble the image's src by yourself on the server. This might be something that would be nice to have as a simple module though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...