📜 ⬆️ ⬇️

Useful and interesting modules for Drupal 6.xx + Tips and Tricks (Part III)

We continue what has been begun, moreover, in the time that has passed since the last review, a lot of interesting modules have accumulated.

For those who missed the beginning, here are the links to previous reviews: Part I and Part II

And by tradition, advice.

We show the number of comments (if they exist, their number will seem, if not, then nothing will seem, for example, this is done on Habré)


/**
* Preprocessor for theme('comment_wrapper').
*/
function __preprocess_comment_wrapper(&$vars) {
$vars[ 'hook' ] = 'box' ;
$vars[ 'attr' ][ 'id' ] = 'comments' ;
$vars[ 'attr' ][ 'class' ] .= ' clear-block' ;

if ($vars[ 'content' ] && $vars[ 'node' ]->type != 'forum' && $vars[ 'node' ]->comment_count != 0) {
$vars[ 'content' ] = '<h2 class="box-title">' . t( 'Comments' ) . '</h2>' . $vars[ 'content' ];
}
}


* This source code was highlighted with Source Code Highlighter .

')

Source: https://habr.com/ru/post/95521/


All Articles