Two PHP-questions
-
This should order posts by date:
if( !function_exists('_sortByDate') ): function _sortByDate($a, $b) { return strtotime($b->post_date) - strtotime($a->post_date); } endif; usort($g_posts, '_sortByDate');
But it doesn’t. Why?
Second question:
This is supposed to get a post’s commenters gravatar:<img src="<?php print $comment->author_avatar; ?>" alt="<?php print $comment->comment_author; ?>" /> if( $the_comment->comment_author_email ) { $the_comment->author_avatar = sprintf("https://www.gravatar.com/avatar/%s?s=68&d=mm&f=y", md5($cdata['comment']->comment_author_email)); } else { $the_comment->author_avatar = "https://www.gravatar.com/avatar/00000000000000000000000000000000?s=68&d=mmf=y"; }
But it only returns the mysterious blank avatar. Why?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Two PHP-questions’ is closed to new replies.