In this chapter we start the background management interface design, this lesson design the navigation bar design.
A Sign Out
logout.php
<?php
Session_Start ();
Session_destroy ();
Header (' location:login.php ');
?>
Two Navigation bar Design
Based on the resulting JSON scheme, the table looks like this:
nav.php
<?php
Require ' config.php ';
$id = Isset ($_post[' id ')? $_post[' id ']: 0;
$query = mysql_query ("Select Id,text,state,iconcls,url from
Easyui_nav WHERE nid= ' $id ' ") or Die (' SQL Error! ‘);
$json = ";
while (!! $row = Mysql_fetch_array ($query, Mysql_assoc)) {
$json. = Json_encode ($row). ', ';
}
$json = substr ($json, 0,-1);
Echo ' ['. $json. '] ';
Mysql_close ();
?>
Tree structure
$ (' #nav '). Tree ({
URL: ' nav.php ',
Lines:true,
Onloadsuccess:function (node, data) {
var _this = this;
if (data) {
$ (data). Each (function (index, value) {
if (this.state = = ' closed ') {
$ (_this). Tree (' ExpandAll ');
}
});
}
},
Onclick:function (node) {
if (Node.url) {
if ($ (' #tabs '). Tabs (' exists ', Node.text)) {
$ (' #tabs '). Tabs (' select ', Node.text)
} else {
$ (' #tabs '). Tabs (' Add ', {
Title:node.text,
Closable:true,
IconCls:node.iconCls,
Href:node.url + '. php ',
});
}
}
}
});
Background management interface--navigation bar design