This contains articles related to theming

Limit the Depth of comment to certain number

In Drupal 7 you might have observed that when you enable the comments on any node at that time it also allows you to add the comments.

In each comment there is link to add the replay, but drupal doesn't provide any management to limit the depth/number of replay using interface or any module.

But we can customize using hook_preprocess_HOOK().

For comment display we have to create hook like themename_preprocess_comment() function in template.php file of theme.

After that we have to find the depth of the comment tree. You can find it using $variables['elements']['#comment']->depth variable. 

Making new variables for use in templates file

 

The variables process functions also allow you to define additional variables in your theme.
 
To create a new variable, you must declare the function in the template. php file. 
 
In order for your theme to have its preprocessors recognized, the template associated with the hook must exist inside the theme.
 
If the template does not exist in your theme, copy (or create) one and place it in the theme directory. 
 
The syntax is the same as that just used for intercepting and overriding a variable, as seen above.
Tags: