命令: {dede:field.id function=’get_lianlun_dq(@me)’/}

    1. function get_lianlun_dq($aid){
    2. global $dsql;
    3. $row = $dsql->GetOne("select relid from dede_link where aid = $aid and fenlei = 'dq' and xmlx = 'rm' and pos = 'all'");
    4. $ids = str_replace('|', ',', $row['relid']);
    5. $sql = "select typename,typedir from dede_arctype where id in ($ids)";
    6. $dsql->Execute('me', $sql);
    7. $str = '';
    8. while ($row = $dsql->GetArray()) {
    9. $str .= '<li class="fl t-c"> <a href="'.$GLOBALS['cfg_basehost'].''.$row['typedir'].'/" title="'.$row['typename'].'一点点官网" target="_blank">'.$row['typename'].'一点点官网</a></li>';
    10. }
    11. if($str == ''){
    12. $typenames = "'重庆'";
    13. $sql = "select typename,typedir from dede_arctype where reid = 17 and typename not in ($typenames) order by rand() limit 20";
    14. $dsql->Execute('me',$sql);
    15. while ($row = $dsql->GetArray()) {
    16. $str .= '<li class="fl t-c"> <a href="'.$GLOBALS['cfg_basehost'].''.$row['typedir'].'/" title="'.$row['typename'].'一点点官网" target="_blank">'.$row['typename'].'一点点官网</a></li>';
    17. }
    18. }
    19. return $str;
    20. }