php 无限分类管理(4)

 

最后就是 sort_tpl.php了 只有一句php输出语句

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  5. <title>mycatalog</title>
  6. <link rel="stylesheet" type="text/css" href="../inc/styles/style.css"/>
  7. <style type="text/css">
  8. <!--
  9. .STYLE1 {color: #000000}
  10. -->
  11. </style>
  12. <SCRIPT LANGUAGE="JavaScript">
  13. <!--
  14. function tree(i,img)
  15. {
  16.     if(isNaN(document.getElementById('div_'+i)))
  17.     {
  18.         if(document.getElementById('div_'+i).style.display=="none") 
  19.         { 
  20.             img.src = 'inc/images/hid.gif';
  21.             document.getElementById('div_'+i).style.display=""
  22.         } 
  23.         else 
  24.         { 
  25.             img.src = 'inc/images/show.gif';
  26.             document.getElementById('div_'+i).style.display="none"
  27.         }
  28.     }
  29.     
  30.     
  31. }
  32. //-->
  33. </SCRIPT>
  34. </head>
  35. <body >
  36. <form id = 'form1' method = 'post' >
  37. <?php echo $str;?>
  38.     
  39. </form>
  40. </body>
  41. </html>

 

css文件

  1. @charset "utf-8";
  2.  *{margin:0padding:0pxfont-family:VerdanaArialHelveticasans-serifcolor:#1f5a8efont-size:12px;}
  3.  HTML {
  4.     PADDING-RIGHT: 0px; PADDING-LEFT: 0px; OVERFLOW-X: hidden; PADDING-BOTTOM: 0px; MARGIN: 0px; WORD-BREAK: break-all; PADDING-TOP: 0px; HEIGHT: 100%; WORD-WRAP: break-word
  5. }
  6. body,html,div,ul,li,ol{
  7. margin:0px;
  8. padding:0px;}
  9. body,html,ul,li{
  10. height:100%;
  11. font:12px/150% "宋体";
  12. word-break:break-all;
  13. word-warp:break-word;
  14. }
  15. ul{list-style:none;}
  16. img{ border:0px;}
  17. .a1{
  18.     color:#lf5a8e;
  19.     font-size:14px;
  20.     font-weightbold;
  21. }
  22. #form1 .container .header a{color:#ffffff;font:12px/150% "宋体";}
  23. .table{border-collapse:collapse;font-size:12pxbackground-color:#FFFFFFtext-align:leftmargin:0px;}
  24. .table tr td{border-bottom:1px solid #1e79b9;border-left:1px solid #1e79b9;border-right:1px solid #1e79b9;padding:3px 0px 3px 5px;}
  25. .table .btr{font-weight:boldbackground-color:#FFFFFF;color:#fff;}
  26. a:link{color:#333text-decoration:none;}
  27. a:visited{color:#333text-decoration:none;}
  28. a:hover{color:#333text-decoration:underline;}
  29. h2{width:640px;;background-color:#999color:#fffmargin:0px auto;border:1px solid #333font-size:14pxpadding:5px 0px 5px 10px;margin-bottom:5px;}
  30. ul,li{list-style:none;}
  31. input{padding:2px;}
  32. .mbody{width:650px;}
  33. .a2{
  34.     color:#lf5a8e;
  35.     font-size:14px;
  36.     
  37. }

ok 类别管理已经over了

如果要添加其他功能在sort.php里面自己修改一下就ok了

需要补充一下,循环和递归是一种效率很低的写法 当类别分层比较多的时候就招架不住了。

换种方式用ajax去取当前类别的子类别然后显示出来也不错。不过我没有做。

打完收工

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值