Friday, September 16, 2011

How to identify if a comment is a reply to a parent comment in Drupal ?

It is pretty simple, but didn't find it listed anywhere,

if($comment->pid ! =0 )
{

//This is a reply to a comment
}

This will come in handy if you want to format a comment reply differently from a parent comment. eg - I had to hide the subject lines in comment replies to avoid too much chatter on the page. However the parent comment was still to have a subject line and hence I could not use the Drupal setting of disabling 'Subject on Comment' under the comment settings.


I now do capture the auto comment titles generated by Drupal on the comment replies but do not show them as in most of the cases, it is redundant with the comment reply.

Hope this will help developers looking for it and save some time !

Book Review - How to have kick ass ideas ?

How to have kick ass ideas ? is written by Chris Barez Brown. The book is a wonderful read for people bored of their routine life and people who are just passing their life, unable to enjoy every moment.
Chris mentions a few examples like - Do you have those Monday blues ?,  Do you feel like life has come to a standstill ?,  Do you wish weekends were longer ? are so common amongst all of us.

I have seen them regularly on my facebook and twitter updates. People are so stuck in their lives without even realizing. The book is a recommended read for them.

Whoever said that children books are more of pictures and less of matter, I read novels which have endless text. This was a great book with its crisp paper quality and lot of imagery. The presentation strikes right into your heart and mind.

It is well organized with the initial chapters identifying the problem and making you realize what you are unable to fathom. The rest of the chapters work through solutions, methodology and  a lot of examples.

Chris explains his story in the first chapter and engages you in his journey of self discovery and change. Then on, you want to listen to how he found his interest, how he changed his life and also the other real life examples.

I would give the book a 4/5 and is a quick read for all the 30 something nearing mid-life crisis folks.