<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[阿Tim日志]]></title> 
<link>https://atim.cn/index.php</link> 
<description><![CDATA[专业的php开发者.开发团队的带队人]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[阿Tim日志]]></copyright>
<item>
<link>https://atim.cn/post//</link>
<title><![CDATA[无限分类(无递归) + 无限联动 + 树状显示(多显示方式) +导航输出 +批量移动 正式版1.1]]></title> 
<author>bkkkd &lt;partybase@gmail.com&gt;</author>
<category><![CDATA[数据应用]]></category>
<pubDate>Sat, 11 Feb 2006 04:57:16 +0000</pubDate> 
<guid>https://atim.cn/post//</guid> 
<description>
<![CDATA[ 
	主要功能：<br/> 不使用递归，直接采用order by按级排序；<br/> 支持无限分类；<br/> 显示类别时可设置从某类别下开始显示，以及设置是否显示子分类；是否带格式输出；<br/> 支持从任何目录的导航输出；<br/> 批量移动分类，批量移动文章,改写关联属性；<br/> 添加文章内容时，要存放亲缘树序列，目的：当选择某一分类查看时，可设置其子分类的文章是否也显示出来。 <br/><br/>程序：无限分类(无递归) &nbsp;+ 无限联动 + 树状显示(多显示方式) +导航输出 +批量移动 正式版1.1<br/>作者：欣然随风（QQ：276624915）<br/>时间：2005-10-28<br/><br/><br/>主要功能：<br/> 不使用递归，直接采用order by按级排序；<br/> 支持无限分类；<br/> 显示类别时可设置从某类别下开始显示，以及设置是否显示子分类；是否带格式输出；<br/> 支持从任何目录的导航输出；<br/> 批量移动分类，批量移动文章,改写关联属性；<br/> 添加文章内容时，要存放亲缘树序列，目的：当选择某一分类查看时，可设置其子分类的文章是否也显示出来。<br/><br/>数据表字段参考：<br/> class_id &nbsp;类别i++号<br/> class_kiss &nbsp;亲缘树序列（资源内容指向此作为奴属，格式1:1:1.. 包括自己当前序列）<br/> class_base &nbsp;根分类序列<br/> class_son &nbsp;子分类序列<br/> class_tier &nbsp;分类所在层<br/> class_name &nbsp;分类名称<br/><br/>其它：<br/> 填写好数据库信息类便可直接运行。 <br/><br/><br/>--------------------------------------------------------------------------------<br/><br/><br/>类文件：sort_class.php<br/><br/><?php<br/><br/>// 数据库信息类<br/>class db<br/>&#123; <br/> const mysql_hdb = "localhost"; // 数据库主机名<br/> const mysql_udb = "root"; &nbsp; // 数据库用户名<br/> const mysql_pdb = "jjfzzzm"; &nbsp;// 数据库密码<br/> const mysql_ddb = "test"; &nbsp; // 数据库名<br/> static $cn; &nbsp; &nbsp; &nbsp; // 数据库连接ID<br/><br/> const table_sort = "class"; // 数据表名<br/><br/> function __construct()<br/> &#123;<br/> &nbsp;self::$cn = @mysql_connect(self::mysql_hdb,self::mysql_udb,self::mysql_pdb)<br/> &nbsp; &nbsp; or die("数据库连接失败，请联系管理员！");<br/> &nbsp;@mysql_select_db(self::mysql_ddb,self::$cn)<br/> &nbsp;or die("数据库选择失败，请联系管理员！");<br/><br/> &nbsp;@mysql_query("Set Names 'gb2312'");<br/> &#125;<br/>&#125;<br/><br/><br/>// 分类信息类<br/>class sort_info<br/>&#123;<br/> /*<br/> 方法用途： 取得某分类的信息<br/> 参数设置： $post_kiss 分类亲缘树<br/> 返回值： 父分类SQL执行号<br/> */<br/> static function sortinfo($post_kiss)<br/> &#123;<br/> &nbsp;$sql = &nbsp;"select * from `".db::table_sort."`<br/> &nbsp; &nbsp; where `class_kiss`='$post_kiss'<br/> &nbsp; &nbsp; LIMIT 1";<br/> &nbsp;return $fs &nbsp;= &nbsp;@mysql_query($sql,db::$cn);<br/> &#125;<br/>&#125;<br/><br/> <br/><br/>// 分类添加类<br/>class sort_add<br/>&#123;<br/> /*<br/> 方法用途： 添加根分类<br/> 参数设置： $post_name 分类名称<br/> &nbsp; &nbsp;$post_js 是否写入JS，默认0不写入，否则值为路径/文件名<br/> 返回值： 添加成功/失败<br/> */<br/> function sort_add_base($post_name,$post_js=0)<br/> &#123;<br/> &nbsp;//取根分类class_base的最大值<br/> &nbsp;$sql = &nbsp;"select max(`class_base`) as `class_base` from `".db::table_sort."`";<br/> &nbsp;$fs &nbsp;= &nbsp;@mysql_query($sql,db::$cn);<br/> &nbsp;$tmp = &nbsp;@mysql_fetch_array($fs);<br/> &nbsp;$nub = &nbsp;++$tmp['class_base'];<br/><br/> &nbsp;//插入新记录<br/> &nbsp;$sql = &nbsp;"insert into `".db::table_sort."` values('', '$nub', '$nub', '0', '1', '$post_name')"; <br/> &nbsp;if(@mysql_query($sql,db::$cn))<br/> &nbsp; $result = TRUE;<br/> &nbsp;else<br/> &nbsp; $result = FALSE;<br/><br/> &nbsp;//插入JS文件<br/> &nbsp;if($result and $post_js!==0)<br/> &nbsp;&#123;<br/> &nbsp; $js = new sort_show;<br/> &nbsp; $jsdata = $js->sort_js_text();<br/><br/> &nbsp; if(sort_js_write::writejs($post_js,$jsdata))<br/> &nbsp; &nbsp;echo "js写入成功！";<br/> &nbsp; else<br/> &nbsp; &nbsp;echo "js写入失败！";<br/> &nbsp;&#125;<br/> &nbsp;return $result;<br/> &#125;<br/><br/><br/> /*<br/> 方法用途： 添加子分类<br/> 参数设置： $post_name 分类名称<br/> &nbsp; &nbsp;$post_kiss 上一层分类亲缘树<br/> &nbsp; &nbsp;$post_js 是否写入JS，默认0不写入，否则值为路径/文件名<br/> 返回值： 添加成功/失败<br/> */<br/> function sort_add_son($post_kiss,$post_name,$post_js=0)<br/> &#123;<br/> &nbsp;$fs &nbsp;= &nbsp;sort_info::sortinfo($post_kiss); &nbsp;// 查询父分类信息<br/> &nbsp;$tmp = &nbsp;@mysql_fetch_array($fs);<br/><br/> &nbsp;$class_base = $tmp['class_base']; &nbsp; &nbsp;//取得根分类<br/> &nbsp;$class_tier = ++$tmp['class_tier']; &nbsp; &nbsp;//取得当前分类所处层号<br/><br/> &nbsp;$sql = &nbsp;"select max(`class_son`) as `class_son`<br/> &nbsp; &nbsp; from `".db::table_sort."`<br/> &nbsp; &nbsp; where `class_kiss` LIKE '$post_kiss%' AND `class_tier`='$class_tier'";<br/> &nbsp;$fs &nbsp;= &nbsp;@mysql_query($sql,db::$cn);<br/> &nbsp;$tmp = &nbsp;@mysql_fetch_array($fs);<br/> &nbsp;$class_son &nbsp;= ++$tmp['class_son']; &nbsp; &nbsp;//取得当前分类在子层的排列序号<br/> &nbsp;$post_kiss .=":".$class_son; &nbsp; &nbsp; //取得当前分类的亲缘树序列<br/><br/> &nbsp;//插入新记录<br/> &nbsp;$sql = "insert into `".db::table_sort."`<br/> &nbsp; &nbsp; values('', '$post_kiss', '$class_base', '$class_son', '$class_tier', '$post_name')"; <br/> &nbsp;if(@mysql_query($sql,db::$cn))<br/> &nbsp; $result = TRUE;<br/> &nbsp;else<br/> &nbsp; $result = FALSE;<br/><br/> &nbsp;//插入JS文件<br/> &nbsp;if($result and $post_js!==0)<br/> &nbsp;&#123;<br/> &nbsp; $js = new sort_show;<br/> &nbsp; $jsdata = $js->sort_js_text();<br/><br/> &nbsp; if(sort_js_write::writejs($post_js,$jsdata))<br/> &nbsp; &nbsp;echo "js写入成功！";<br/> &nbsp; else<br/> &nbsp; &nbsp;echo "js写入失败！";<br/> &nbsp;&#125;<br/> &nbsp;return $result;<br/> &#125;<br/>&#125;<br/><br/> <br/><br/><br/>// 分类编辑类<br/>class sort_ovr<br/>&#123;<br/> /*<br/> 方法用途： 更新分类名称/批量移动目录(连带移动子目录)<br/><br/> 参数设置： $post_kiss1 提交的该分类亲缘树<br/> &nbsp; &nbsp;$post_kiss2 提交的目标亲缘树（不移动分类则默认FALSE,移动到根值为字符串“base”）<br/> &nbsp; &nbsp;$post_name 提交的分类名（不更改则默认FALSE）<br/> &nbsp; &nbsp;$post_js 更新JS菜单 值为路径/文件名<br/><br/> 返回值： 无<br/> */<br/> public $post_kiss1; // 当前目录的亲缘树<br/> public $post_kiss3; // 移至新位置的亲缘树<br/> public $post_base; // 移至新位置的根<br/> public $post_tier; // 移至新位置层(差)<br/> public $off = 0; // 顺序执行操作开关<br/> public $len; &nbsp;// 当前亲缘树长度<br/><br/> function sortovr($post_kiss1 , $post_kiss2=FALSE , $post_name=FALSE , $post_js)<br/> &#123;<br/><br/> &nbsp;$this->len = strlen($post_kiss1);<br/> &nbsp;$this->post_kiss1 = $post_kiss1;<br/><br/> &nbsp;if($post_name !== FALSE)<br/> &nbsp;&#123;<br/> &nbsp; $sql = "UPDATE ".db::table_sort." SET `class_name`='$post_name' WHERE `class_kiss`='$post_kiss1' LIMIT 1";<br/> &nbsp; if(@mysql_query($sql,db::$cn))<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;$this->off = 1;<br/> &nbsp; &nbsp;echo "分类名编辑成功！";<br/> &nbsp; &#125;<br/> &nbsp; else<br/> &nbsp; &nbsp;echo "分类名编辑失败！";<br/> &nbsp;&#125;<br/><br/> &nbsp;if($post_kiss2 !== FALSE)<br/> &nbsp;&#123;<br/> &nbsp; $fs &nbsp;= sort_info::sortinfo($post_kiss1); &nbsp; &nbsp;// 查询当前分类信息<br/> &nbsp; $tmp = @mysql_fetch_array($fs);<br/> &nbsp; $tier= $tmp['class_tier']; &nbsp; &nbsp; &nbsp; &nbsp;// 当前层号<br/><br/> &nbsp; // 移动到根时的处理<br/> &nbsp; if($post_kiss2 == "base")<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;$sql = &nbsp;"select max(`class_base`) as `class_base` from `".db::table_sort."`";<br/> &nbsp; &nbsp;$fs &nbsp;= &nbsp;@mysql_query($sql,db::$cn);<br/> &nbsp; &nbsp;$tmp = &nbsp;@mysql_fetch_array($fs);<br/> &nbsp; &nbsp;$this->post_base = ++$tmp['class_base']; &nbsp; //最终根分类号<br/> &nbsp; &nbsp;$this->post_kiss3 = $tmp['class_base']; &nbsp; &nbsp;//最终亲缘树<br/> &nbsp; &nbsp;$class_tier = 1; &nbsp; &nbsp; &nbsp; &nbsp; //最终层号<br/> &nbsp; &nbsp;$class_son &nbsp;= 0; &nbsp; &nbsp; &nbsp; &nbsp; //最终子类排序号<br/><br/> &nbsp; &#125;<br/> &nbsp; // 不为根的处理<br/> &nbsp; else<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;$fs &nbsp;= sort_info::sortinfo($post_kiss2); &nbsp; // 查询目标分类信息<br/> &nbsp; &nbsp;$tmp = @mysql_fetch_array($fs);<br/><br/> &nbsp; &nbsp;$this->post_base = $tmp['class_base']; &nbsp; &nbsp;//最终根分类号<br/> &nbsp; &nbsp;$class_tier = ++$tmp['class_tier']; &nbsp; &nbsp; //最终层号<br/><br/> &nbsp; &nbsp;$sql = &nbsp;"select max(`class_son`) as `class_son`<br/> &nbsp; &nbsp; &nbsp; from `".db::table_sort."`<br/> &nbsp; &nbsp; &nbsp; where `class_kiss` LIKE '$post_kiss2%' AND `class_tier`='$class_tier'";<br/> &nbsp; &nbsp;$fs &nbsp;= @mysql_query($sql,db::$cn);<br/> &nbsp; &nbsp;$tmp = @mysql_fetch_array($fs);<br/> &nbsp; &nbsp;$class_son &nbsp;= ++$tmp['class_son']; &nbsp; &nbsp; //最终子类排序号<br/> &nbsp; &nbsp;$this->post_kiss3 = $post_kiss2.":".$class_son; &nbsp;//最终亲缘树<br/> &nbsp; &#125;<br/><br/> &nbsp; $this->post_tier = $class_tier - $tier; &nbsp; &nbsp; //层差值<br/><br/> &nbsp; // 移动当前目录<br/> &nbsp; $sql = "UPDATE ".db::table_sort." SET <br/> &nbsp; &nbsp; `class_kiss`='$this->post_kiss3',<br/> &nbsp; &nbsp; `class_base`='$this->post_base',<br/> &nbsp; &nbsp; `class_son`='$class_son',<br/> &nbsp; &nbsp; `class_tier`='$class_tier'<br/> &nbsp; &nbsp; &nbsp;WHERE `class_kiss` = '$post_kiss1' LIMIT 1";<br/><br/> &nbsp; if(@mysql_query($sql,db::$cn))<br/> &nbsp; &#123; <br/> &nbsp; &nbsp;$this->off = 1;<br/> &nbsp; &nbsp;echo "目录移动成功！";<br/> &nbsp; &#125;<br/> &nbsp; else<br/> &nbsp; &nbsp;echo "目录移动失败！";<br/><br/><br/> &nbsp; // 移动所有受影响子目录<br/> &nbsp; if($this->off == 1)<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;$sql = "UPDATE ".db::table_sort." SET <br/> &nbsp; &nbsp; &nbsp;`class_kiss`=INSERT(`class_kiss`,1,$this->len,'$this->post_kiss3'),<br/> &nbsp; &nbsp; &nbsp;`class_base`='$this->post_base',<br/> &nbsp; &nbsp; &nbsp;`class_tier`=`class_tier`+'$this->post_tier'<br/> &nbsp; &nbsp; &nbsp; WHERE `class_kiss` LIKE '$post_kiss1%'";<br/><br/> &nbsp; &nbsp;if(@mysql_query($sql,db::$cn))<br/> &nbsp; &nbsp; echo "子分类移动成功！";<br/> &nbsp; &nbsp;else<br/> &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; $this->off = 0;<br/> &nbsp; &nbsp; echo "子分类移动失败！";<br/> &nbsp; &nbsp;&#125;<br/> &nbsp; &#125;<br/> &nbsp;&#125;<br/><br/><br/> &nbsp;// 更新JS文件<br/> &nbsp;if($this->off == 1)<br/> &nbsp;&#123;<br/> &nbsp; $js = new sort_show;<br/> &nbsp; $jsdata = $js->sort_js_text();<br/> &nbsp; if(sort_js_write::writejs($post_js,$jsdata))<br/> &nbsp; &nbsp;echo "js写入成功！";<br/> &nbsp; else<br/> &nbsp; &nbsp;echo "js写入失败！";<br/> &nbsp;&#125;<br/> &#125;<br/><br/> /*<br/> 方法用途： 移动所有关联资源内容的目录指向（如内容表的记录对奴属目录的指向）<br/><br/> 参数设置： $name_table &nbsp;待修改的表名<br/> &nbsp; &nbsp;$name_sort &nbsp;待修改的存储分类亲缘树的字段名<br/> 返回值： 无<br/> */<br/> function textovr($name_table,$name_sort)<br/> &#123;<br/> &nbsp;if($this->off == 1)<br/> &nbsp;&#123;<br/> &nbsp; $name_table = "`".$name_table."`";<br/> &nbsp; $name_sort &nbsp;= "`".$name_sort."`";<br/><br/> &nbsp; $sql = "UPDATE $name_table SET <br/> &nbsp; &nbsp; $name_sort=INSERT($name_sort,1,$this->len,'$this->post_kiss3')<br/> &nbsp; &nbsp; &nbsp;WHERE $name_sort LIKE '$this->post_kiss1%'";<br/> &nbsp; if(@mysql_query($sql,db::$cn))<br/> &nbsp; &nbsp;echo "资源目录指向移动成功！";<br/> &nbsp; else<br/> &nbsp; &nbsp;echo "资源目录指向移动失败！";<br/> &nbsp;&#125;<br/> &#125;<br/>&#125;<br/><br/><br/>// 分类显示类<br/>class sort_show<br/>&#123;<br/> /*<br/> 方法用途： 获取分类信息执行号<br/> 参数设置： $post_kiss 设置从某分类下开始显示(传入值应为上层分类的亲缘树序列)，默认0为从根开始显示<br/> &nbsp; &nbsp;$post_wise 设置显示方式：1为显示该类的所有子分类，0为只显示当前层次的分类<br/> 返回值： sql执行号<br/> */<br/><br/> public $sqldata;<br/> public $class_tier=1; &nbsp;// 当前分类层号，用于格式输出时减去空格,1为减根<br/><br/> function __construct($post_kiss=0,$post_wise=1)<br/> &#123;<br/> &nbsp;if($post_kiss>0)<br/> &nbsp;&#123;<br/> &nbsp; $fs &nbsp;= &nbsp;sort_info::sortinfo($post_kiss); // 取得父分类信息<br/> &nbsp; $tmp = &nbsp;@mysql_fetch_array($fs);<br/><br/> &nbsp; $this->class_tier = ++$tmp['class_tier']; &nbsp; // 取得该分类的层号 &nbsp;<br/> &nbsp;<br/> &nbsp; $post_kiss = "`class_kiss` LIKE '$class_kiss%'";<br/> &nbsp; if($post_wise==0)<br/> &nbsp; &nbsp; $post_wise="'$this->class_tier' = `class_tier`";<br/> &nbsp; &nbsp;else<br/> &nbsp; &nbsp; $post_wise=" `class_tier` >= '$this->class_tier'";<br/> &nbsp;&#125;<br/> &nbsp;else<br/> &nbsp;&#123;<br/> &nbsp; $post_kiss=1;<br/> &nbsp; if($post_wise==0) $post_wise="`class_tier` = '1'";<br/> &nbsp;&#125;<br/><br/> &nbsp;$sql = "select * from `".db::table_sort."`<br/> &nbsp; &nbsp; where $post_kiss and $post_wise<br/> &nbsp; &nbsp; order by `class_base` asc, `class_kiss` asc, `class_son` asc";<br/><br/> &nbsp;$this->sqldata &nbsp;= @mysql_query($sql,db::$cn);<br/> &#125;<br/><br/><br/> /*<br/> 方法用途： 列表显示分类<br/> 参数设置： $type 显示方式（默认0为不带格式输出，要带格式则参数为分级符号，如“└”）<br/> 返回值： 无<br/> */<br/> function show($type)<br/> &#123;<br/> &nbsp;if($type=="0")<br/> &nbsp;&#123;<br/> &nbsp; while($tmp = @mysql_fetch_array($this->sqldata))<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;echo $tmp['class_name']."<br/>";<br/> &nbsp; &#125;<br/> &nbsp;&#125;<br/> &nbsp;else<br/> &nbsp;&#123;<br/> &nbsp; while($tmp = @mysql_fetch_array($this->sqldata))<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;$nub=str_repeat("　",($tmp['class_tier']-$this->class_tier))."$type"; //使用空格缩进和$type符号产生分级<br/> &nbsp; &nbsp;echo $nub.$tmp['class_name']."<br/>";<br/> &nbsp; &#125;<br/> &nbsp;&#125;<br/> &#125;<br/><br/><br/> /*<br/> 方法用途： 生成待写入js文本内容<br/> 返回值： 字符串<br/> */<br/> function sort_js_text()<br/> &#123;<br/> &nbsp;while($tmp = @mysql_fetch_array($this->sqldata))<br/> &nbsp;&#123;<br/> &nbsp; $nub=str_repeat("　",$tmp['class_tier']); //使用空格缩进<br/> &nbsp; $jsdata .= $nub."[".--$tmp['class_tier'].","".$tmp['class_name']."","".$tmp['class_kiss'].""],".chr(13);<br/> &nbsp;&#125;<br/><br/> &nbsp;$jsdata = substr($jsdata, -strlen($jsdata), -2); &nbsp; &nbsp;//去除最后一个逗号和最后一个换行<br/> &nbsp;return "var arrType=new Array(".chr(13).$jsdata.");";<br/> &#125;<br/><br/>&#125;<br/><br/> <br/><br/>// 导航信息类<br/>class sort_boat<br/>&#123;<br/> /*<br/> 方法用途： 输出某类别的所有上级目录(导航)<br/> 参数设置： $post_kiss 某类亲缘树<br/> 返回值： 无<br/> */<br/> function boat_show($post_kiss)<br/> &#123;<br/> &nbsp;$class_kiss =explode(":",$post_kiss); &nbsp;// 分拆亲缘树序列<br/> &nbsp;$nub = sizeof($class_kiss); &nbsp; &nbsp; // 元素个数<br/><br/> &nbsp;// 取得各层亲缘树序列数组<br/> &nbsp;for($i=0;$i<$nub;$i++)<br/> &nbsp;&#123;<br/> &nbsp; if($i>=1) $kiss_val .= ":";<br/> &nbsp; $kiss_val &nbsp;.= $class_kiss[$i];<br/> &nbsp; $kiss_arr[] = "'".$kiss_val."'=`class_kiss`";<br/> &nbsp;&#125;<br/> &nbsp;<br/> &nbsp;// 生成sql查询条件<br/> &nbsp;$kiss_val = implode(" OR ",$kiss_arr);<br/> &nbsp;$sql = "select * from `".db::table_sort."`<br/> &nbsp; &nbsp; where $kiss_val order by `class_tier`";<br/> &nbsp;$fs &nbsp;= @mysql_query($sql,db::$cn);<br/> &nbsp;while($tmp = @mysql_fetch_array($fs))<br/> &nbsp;&#123;<br/> &nbsp; echo " >> ".$tmp['class_name'];<br/> &nbsp;&#125;<br/> &#125;<br/>&#125;<br/><br/><br/>// 写入JS文件类<br/>class sort_js_write<br/>&#123;<br/> /*<br/> 方法用途： 写入JS分类数据<br/> 参数设置： $fileurl 文件路径/文件名<br/> &nbsp; &nbsp;$filetext 写入内容<br/> 返回值： 成功/失败<br/> */<br/> function writejs($fileurl,$filetext)<br/> &#123;<br/> &nbsp;$no = fopen($fileurl, 'w');<br/> &nbsp;$no = fwrite($no,$filetext);<br/><br/> &nbsp;return ($no)?true:false;<br/> &#125;<br/>&#125;<br/><br/>?><br/><br/><br/><br/>--------------------------------------------------------------------------------<br/><br/><br/>添加分类演示：add_sort.php<br/><br/><html><br/><head><br/><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br/><title>无级分类(无递归) + 树状显示(多显示方式) +导航输出 +批量移动 + 无级联动 演示</title><br/><style type="text/css"><br/><!--<br/>body,td,th &#123;<br/> font-size: 12px;<br/>&#125;<br/>--><br/></style></head><br/><br/><body><br/><SCRIPT language=javascript src="sort_code.js"></SCRIPT><br/><SCRIPT language=javascript src="sort_type.js"></SCRIPT><br/><br/><form id="form1" name="form1" method="post" action="" onSubmit="return checkform(this)"><br/> <table width="100%" cellspacing="1" bgcolor="#EFEBDE"><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td height="20" bgcolor="#FFCC00">添加分类：(如果选择了写入JS，则会更新级联菜单，但由于浏览器缓存的原因，你要重新开窗口才能看到！) &nbsp; &nbsp;</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF">位置：<br/> &nbsp;<SCRIPT language=JavaScript>drawSelect(null,"arrType",0,"in_dId","","当前层");</SCRIPT> &nbsp;</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF">名称：<br/> &nbsp; &nbsp; &nbsp; &nbsp;<input name="name" type="text" /><br/> &nbsp; &nbsp; &nbsp; &nbsp;</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF"><input name="js" type="checkbox" value="1" /><br/>写入到JS</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#CCCCCC"><input name="post" type="submit" value="提交" /></td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp;</table><br/> &nbsp;<br/> &nbsp; &nbsp; &nbsp;<br/><br/></form><br/><br/><br/><?php<br/>include("sort_class.php");<br/>new db;<br/><br/>// ---------- 添加分类调用 ------------<br/>if(isset($_POST["post"]))<br/>&#123;<br/> if($_POST["name"]!="")<br/> &#123;<br/> &nbsp; $add = new sort_add;<br/> &nbsp; if($_POST["js"]==1) $_POST["js"]="sort_type.js"; else $_POST["js"]=0;<br/><br/><br/> &nbsp; if($_POST["in_dId"] == "")<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;//if($add->sort_add_base("根分类名","是否写入JS/0为不写"))<br/> &nbsp; &nbsp;if($add->sort_add_base($_POST["name"],$_POST["js"]))<br/> &nbsp; &nbsp;echo "根分类添加成功";<br/> &nbsp; &#125;<br/> &nbsp; else<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;//if($add->sort_add_son("父目录亲缘树","子分类名","是否写入JS"))<br/> &nbsp; &nbsp;if($add->sort_add_son($_POST["in_dId"],$_POST["name"],$_POST["js"]))<br/> &nbsp; &nbsp;echo "子分类添加成功";<br/> &nbsp; &#125;<br/> &#125;<br/> else<br/> &nbsp;echo "请输入分类名称！";<br/>&#125;<br/><br/> <br/><br/>echo "<br/>---------- 导航显示调用 ------------<br/>";<br/> $boat = new sort_boat;<br/><br/> $boat->boat_show("2:1:1:1"); &nbsp; //("某目录亲缘树,如：1:3:22:44");<br/><br/> <br/><br/><br/>echo "<br/><br/>---------- 显示分类调用 ------------<br/>";<br/> $show = new sort_show(0,1); //(某分类的亲缘树/0为根,显示包含子类1/显示当前层分类0)<br/><br/> $show->show("└ "); &nbsp; &nbsp;//(分类前缀的符号，如不使用格式，则设置为0)<br/><br/>?><br/></body><br/></html><br/><br/><br/><br/>--------------------------------------------------------------------------------<br/><br/><br/>编辑分类演示：ovr_sort.php<br/><br/><html><br/><head><br/><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br/><title>无级分类(无递归) + 树状显示(多显示方式) +导航输出 +批量移动 + 无级联动 演示</title><br/><style type="text/css"><br/><!--<br/>body,td,th &#123;<br/> font-size: 12px;<br/>&#125;<br/>.STYLE1 &#123;color: #FF0000&#125;<br/>--><br/></style></head><br/><br/><body><br/><SCRIPT language=javascript src="sort_code.js"></SCRIPT><br/><SCRIPT language=javascript src="sort_type.js"></SCRIPT><br/><br/><form id="form1" name="form1" method="post" action="" onSubmit="return checkform(this)"><br/> <table width="100%" cellspacing="1" bgcolor="#EFEBDE"><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td height="20" bgcolor="#FFCC00">分类编辑：</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF">将分类：<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<SCRIPT language=JavaScript>drawSelect(null,"arrType",0,"in_dId","","<-当前分类");</SCRIPT> &nbsp;</td><br/> &nbsp; &nbsp; &nbsp;</tr><tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF">移动至：<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<SCRIPT language=JavaScript>drawSelect(null,"arrType",0,"in_dId1","","↓当前位置");</SCRIPT> &nbsp;</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF"><input name="no" type="checkbox" value="1" /><br/> &nbsp; &nbsp; &nbsp; &nbsp;确认移动分类？ (移动分类将连带移动所有该目录的子分类，并且更新所有关联资源的目录指向，如文章信息的所属目录指向！建议在添加资源前设置好分类，一旦投入应用，虽本程序能够无损转移，但将耗费较大资源。若站点投入应用1年以上，建议不使用！) </td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF">名称修改为：<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input name="name" type="text" /><br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(不改名称则不填写) &nbsp; &nbsp; &nbsp; &nbsp;</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#FFFFFF"><span class="STYLE1">强烈说明：</span> 程序将自动更新JS级联菜单。切记：由于浏览器缓存的原因，你要重新开窗口才能看到！ &nbsp; &nbsp;如果你执行一次移动后没开新窗口刷新JS菜单，这时如果再执行转移操作，JS传入的值将是老数据，与当前库中的不一致，这将打乱所有数据库关联。哭吧！！</td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp; &nbsp;<tr><br/> &nbsp; &nbsp; &nbsp; &nbsp;<td bgcolor="#CCCCCC"><input name="post" type="submit" id="post3" value="提交" /></td><br/> &nbsp; &nbsp; &nbsp;</tr><br/> &nbsp; &nbsp;</table><br/> &nbsp;<br/> &nbsp; &nbsp; &nbsp;<br/><br/></form><br/><br/><br/><?php<br/>include("sort_class.php");<br/>new db;<br/><br/>// ---------- 编辑分类调用 ------------<br/>if(isset($_POST["post"]))<br/>&#123;<br/> if($_POST["in_dId"]!="")<br/> &#123;<br/> &nbsp; if($_POST["name"]=="") $_POST["name"]=FALSE;<br/> &nbsp; if($_POST["no"]==1)<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;if($_POST["in_dId1"]=="") $_POST["in_dId1"]="base";<br/> &nbsp; &#125;<br/> &nbsp; else<br/> &nbsp; &nbsp;$_POST["in_dId1"]=FALSE;<br/><br/> &nbsp; $ovr = new sort_ovr;<br/> &nbsp; //参数("待修改分类/不更改值为FALSE","新位置/base表根/不更改值为FALSE","新类名/不更改值为FALSE","更新JS菜单")<br/> &nbsp; $ovr->sortovr($_POST["in_dId"] , $_POST["in_dId1"] , $_POST["name"] , "sort_type.js");<br/><br/> <br/><br/> &nbsp; /*<br/> &nbsp; &nbsp;如果对目录进行了批量移动，不要忘了执行下边这句：转移受影响的内容奴属目录指向。<br/> &nbsp; &nbsp;没有把它直接写到目录移动后就自动执行，是因为有些系统可能不止一个表使用目录库，因此在下边手动指定要改哪些表！<br/> &nbsp; */<br/><br/> &nbsp; // $ovr->textovr("表1","关联目录字段名");<br/> &nbsp; // $ovr->textovr("表2","关联目录字段名");<br/> &nbsp; // .... 有多少表使用了就执行多少次<br/><br/><br/> &#125;<br/> else<br/> &nbsp;echo "未指定待编辑分类！";<br/>&#125;<br/><br/> <br/><br/>echo "<br/>---------- 导航显示调用 ------------<br/>";<br/> $boat = new sort_boat;<br/><br/> $boat->boat_show("2:1:1:1"); &nbsp; //("某目录亲缘树,如：1:3:22:44");<br/><br/> <br/><br/><br/>echo "<br/><br/>---------- 显示分类调用 ------------<br/>";<br/> $show = new sort_show(0,1); //(某分类的亲缘树/0为根,显示包含子类1/显示当前层分类0)<br/><br/> $show->show("└ "); &nbsp; &nbsp;//(分类前缀的符号，如不使用格式，则设置为0)<br/><br/>?><br/></body><br/></html><br/>
]]>
</description>
</item><item>
<link>https://atim.cn/post//#blogcomment</link>
<title><![CDATA[[评论] 无限分类(无递归) + 无限联动 + 树状显示(多显示方式) +导航输出 +批量移动 正式版1.1]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://atim.cn/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>