解决emlog5.3.1默认模板前台顶级分类无法获取子分类文章数量bug
[ 2015/01/08, Emlog , 3024阅, 0评 ]

直接用以下代码替换module.php文件中的同类代码即可!

<?php
//widget:分类
function widget_sort($title){
	global $CACHE;
	$sort_cache = $CACHE->readCache('sort'); ?>
	<li>
	<h3><span><?php echo $title; ?></span></h3>
	<ul id="blogsort">
	<?php
	foreach($sort_cache as $value):
		if ($value['pid'] != 0) continue;
		$logsnum = $value['lognum'];
	?>
	<?php if (!empty($value['children'])): ?>
		<?php
		$children0 = $value['children'];
		foreach ($children0 as $key):
			$value0 = $sort_cache[$key];
			$logsnum += $value0['lognum'];
		endforeach; ?>
	<?php endif; ?>
	<li>
	<a href="<?php echo Url::sort($value['sid']); ?>"><?php echo $value['sortname']; ?>(<?php echo $logsnum; ?>)</a>		
	<?php if (!empty($value['children'])): ?>
		<ul>
		<?php
		$children = $value['children'];
		foreach ($children as $key):
			$value = $sort_cache[$key];
		?>
		<li><a href="<?php echo Url::sort($value['sid']); ?>"><?php echo $value['sortname']; ?>(<?php echo $value['lognum'] ?>)</a></li>
		<?php endforeach; ?>
		</ul>
	<?php endif; ?>
    </li>
	<?php endforeach; ?>
	</ul>
<?php }?>

有朋自远方来...评论一下呗O(∩_∩)O