php代码:
<?php //网站导航栏目id class navigation { var $class; var $classstr = ""; function __construct($id) { $this->class = $id; } function ishave($id) { global $myobj,$language; $sql = "select * from cy_{$language}_sitecategory where did = ".$id; $result = $myobj->getRowsRst($sql); return $result; } function subclass($id) { global $myobj,$language; $sql = "select * from cy_{$language}_sitecategory where did = ".$id; $rs = $myobj->query($sql); while($rt = $myobj->getarray($rs)) { $classstr .= $rt['id'].', '; } return $classstr; } function classname() { global $myobj,$language; $tmpstr = ""; $sql = "select * from cy_{$language}_sitecategory where did = ".$this->class; $rs = $myobj->query($sql); while($rt = $myobj->getarray($rs)) { if($this->ishave($rt['id'])) { $tmpstr = $this->subclass($rt['id']); } $classstr .= $rt['id'].', '; } return empty($tmpstr)?$classstr:$classstr.$tmpstr; } } ?>