<?php
//获取文章缩略图
function get_thum($logid){$db = MySql::getInstance();$sqlimg = "SELECT * FROM ".DB_PREFIX."attachment WHERE blogid=".$logid." AND (`filepath` LIKE '%jpg' OR `filepath` LIKE '%gif' OR `filepath` LIKE '%png') and width<=420 ORDER BY `aid` ASC LIMIT 0,1";$img = $db->query($sqlimg);while($roww = $db->fetch_array($img)){$thum_url=BLOG_URL.substr($roww['filepath'],3,strlen($roww['filepath']));}if (empty($thum_url)) {srand((double)microtime()*1000000);$randval = rand(1,10);$thum_url = TEMPLATE_URL.'rand/'.$randval.'.jpg';}return $thum_url;}?> <?php
//blog:相邻文章
function neighbor_log($neighborLog){
extract($neighborLog);?>
<?php if($prevLog):?>
<p><a href="<?php echo Url::log($prevLog['gid']) ?>"><img src="<?php echo get_thum($prveLog['gid']);?>" alt="<?php echo $prevLog['title'];?>" width="120" height="120" /></a></p>
<?php else:?>
<p>上一篇:没有了</p>
<?php endif;?>
<?php if($nextLog):?>
<p><a href="<?php echo Url::log($nextLog['gid']) ?>"><img src="<?php echo get_thum($nextLog['gid']);?>" alt="<?php echo $nextLog['title'];?>" width="120" height="120" /></a></p>
<?php else:?>
<p>下一篇:没有了</p>
<?php endif;?>
<?php }?> 免责声明:
本页网址:点击复制分享给朋友吧!
本站分享的一切内容资源如若没有备注,均为蓝叶原创,如需转载请注明出处;如有侵权请与我们联系处理。敬请谅解!