欢迎访问 舍力博客(www.shuyong.net)
<?php function page_like(){ $db = MySql::getInstance(); $sql = "SELECT * FROM " . DB_PREFIX . "link WHERE hide='y' ORDER BY taxis ASC"; $result = $db->query($sql); while($row = $db->fetch_array($result)){ ?> <li><a href="<?php echo $row['siteurl']; ?>" title="<?php echo $row['description']; ?>" target="_blank"><?php echo $row['sitename']; ?></a></li> <?php } ?> <?php } ?>
<?php function link_n(){$db = MySql::getInstance();?> <?php $sql = "SELECT sitename,id,description,siteurl,hide FROM ".DB_PREFIX."link ORDER BY `id` "; $list = $db->query($sql);while($row = $db->fetch_array($list)){ if($row['hide']=='n'){$yes="1";}else{$yes="2";}?> <?php if($yes=='2'): ?> <a title="<?php echo $row['description']; ?>" href="<?php echo $row['siteurl']; ?>" target="_blank"><?php echo $row['sitename']; ?></a> <?php else:endif; }} ?>
<?php //内页链接 function ny_links(){$db = MySql::getInstance();$sql = "SELECT * FROM " . DB_PREFIX . "link WHERE hide='y' ORDER BY taxis ASC";$result = $db->query($sql);?> <li><h3><span>友链链接(内页)</span></h3><ul id="link"> <?php while($row = $db->fetch_array($result)){ ?> <li><a href="<?php echo $row['siteurl']; ?>" title="<?php echo $row['description']; ?>"><div style="background:url(<?php echo $row['siteurl']; ?>/favicon.ico) no-repeat;background-size:16px; background-position: 50% center;float:left;width:16px;height:16px;margin:5px 2px 0 0px;"></div><?php echo $row['sitename']; ?></a></li> <?php }?></ul></li><?php }?>在模板文件side.php的</ul>前面加入如下代码:
<?php if("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL) {}else{ny_links();}?>
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。