ZBlogPHP::AddItemToNavbar PHP Method

AddItemToNavbar() public method

向导航菜单添加相应条目
public AddItemToNavbar ( string $type = 'item', string $id, string $name, string $url )
$type string $type=category,tag,page,item
$id string
$name string
$url string
    public function AddItemToNavbar($type = 'item', $id, $name, $url)
    {
        if (!$type) {
            $type = 'item';
        }
        $m = $this->modulesbyfilename['navbar'];
        $s = $m->Content;
        $a = '<li id="navbar-' . $type . '-' . $id . '"><a href="' . $url . '">' . $name . '</a></li>';
        if ($this->CheckItemToNavbar($type, $id)) {
            $s = preg_replace('/<li id="navbar-' . $type . '-' . $id . '">.*?<\\/li>/', $a, $s);
        } else {
            $s .= '<li id="navbar-' . $type . '-' . $id . '"><a href="' . $url . '">' . $name . '</a></li>';
        }
        $m->Content = $s;
        $m->Save();
    }
ZBlogPHP