如果有人用我那个Emlog6.0特别版
下面介绍友情分类获取方式
效果可以去我邻居看

获取所有链接分类

 
  1. <?php
  2. function getLinkSort(){
  3. global $CACHE;
  4. $sortlink_cache = $CACHE->readCache('sortlink'); ?>
  5. <?php foreach($sortlink_cache as $value):?>
  6. <li sid="<?php echo $value['linksort_id']; ?>"><?php echo $value['linksort_name']; ?></li>
  7. <?php endforeach; ?>
  8. <?php }?>

按分类显示链接

 
  1. <?php
  2. function sortLinks(){
  3. $db = Database::getInstance();
  4. global $CACHE;
  5. $sortlink_cache = $CACHE->readCache('sortlink');
  6. foreach($sortlink_cache as $value){
  7. $out .= '<dl id="item'.$value['linksort_id'].'"><dt>'.$sortlink_cache[$value['linksort_id']]['linksort_name'].'</dt><ul>';
  8. $links = $db->query ("SELECT * FROM ".DB_PREFIX."link WHERE linksortid='$value[linksort_id]' AND hide='n' order by id DESC");
  9. while ($row = $db->fetch_array($links)){
  10. $out .='<li><a href="'.$row['siteurl'].'" title="'.$row['description'].'" target="_blank">'.$row['sitename'].'</a></li>';
  11. }
  12. $out .='</ul></dl>';
  13. }
  14. echo $out;
  15. }?>

获取指定分类链接

 
  1. <?php
  2. function getOneSortLink($num) {
  3. $db = Database::getInstance();
  4. $sql = "SELECT * FROM ".DB_PREFIX."link WHERE linksortid='1' and hide='n' LIMIT 0,$num";
  5. $list = $db->query($sql);
  6. while($row = $db->fetch_array($list)){ ?>
  7. <a href="<?php echo $row['siteurl']; ?>" target="_blank"><?php echo $row['sitename']; ?></a>
  8. <?php } ?>
  9. <?php } ?>