Exemplo n.º 1
0
/**
 * 面包屑
 * @param $type
 * @param string $info
 * @param string $ul_attr
 * @param string $li_attr
 * @param string $separator
 * @param string $init
 * @return string
 */
function get_breadcrumbs($type, $info = '', $ul_attr = ' class="breadcrumbs "', $li_attr = '', $separator = ' <li> &gt;&gt; </li> ', $init = '首页')
{
    $res = '<li><a href = "' . U("/") . '" > ' . $init . '</a></li>';
    if ($type == 'cats') {
        $Cat = D('Cats', 'Logic');
        $cat = $Cat->getFather($info);
        $res .= extra_father($cat, $separator);
    } elseif ($type == 'tags') {
        $Tag = D('Tags', 'Logic');
        $tag = $Tag->detail($info, false);
        $res .= $separator . '<li><a href = "' . getTagURLByID($tag['tag_id']) . '">' . $tag['tag_name'] . ' </a ></li> ';
    } elseif ($type == 'post') {
        $cat = $info['post_cat'][0];
        $res .= $separator . '<li><a href = "' . get_cat_url($cat['cat_id']) . '">' . $cat['cat_name'] . ' </a ></li> ';
        $res .= $separator . '<li><a href = "' . get_post_url($info) . '">' . $info['post_title'] . ' </a ></li> ';
    } else {
        $res .= $separator . '<li>' . $type . '</li>';
    }
    $res .= '';
    return $res;
}
</a> |
                                    <i class="icon-folder-close"></i> 分类:
                                    <?php 
            if (is_array($post["post_cat"])) {
                $i = 0;
                $__LIST__ = $post["post_cat"];
                if (count($__LIST__) == 0) {
                    echo "";
                } else {
                    foreach ($__LIST__ as $key => $cat) {
                        $mod = $i % 2;
                        ++$i;
                        ?>
<a
                                            href="<?php 
                        echo get_cat_url($cat);
                        ?>
"><?php 
                        echo $cat["cat_name"];
                        ?>
</a>,<?php 
                    }
                }
            }
            ?>
                                    |
                                    <i class="icon-folder-close"></i> 标签:
                                    <?php 
            if (is_array($post["post_tag"])) {
                $i = 0;
                $__LIST__ = $post["post_tag"];