风讯官方论坛FoosunCMS交流区Foosun4.x安装使用栏目导航改进,增加根栏目导航锁定功能

1  /  1  页   1 跳转 查看:314

标题: 栏目导航改进,增加根栏目导航锁定功能

栏目导航改进,增加根栏目导航锁定功能

版本:4.0 sp5

现有的“栏目导航”不选择栏目,生成首页和栏目页面时,导航不相同。如果“选择栏目”,那么所有的生成页面导航都是相同的。

可惜“选择栏目”后,不能生成根栏目导航。

我做了一下改进,增加了“锁定栏目”的功能

1、不选择栏目+锁定栏目:生成根栏目导航
2、 选择栏目+锁定栏目:生成“选择栏目”导航
3、选择栏目+不锁定:选择栏目无效,根据生成的页面生成不同的导航
4、不选择栏目+不锁定:效果与第3条相同




代码修改:

News_C_Label.asp

<%sub ClassNavi()%>
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
  <tr>
  <td width="22%" class="hback">
    <div align="right">选择栏目</div>
  </td>
  <td width="78%" class="hback">
    <input  name="ClassName" type="text" id="ClassName" size="12" readonly>
    <input name="ClassID" type="hidden" id="ClassID">
    <input name="button22" type="button"  value="选择栏目">
    <span class="tx">如果不选择,那么在某个类就调用某个类的导航</span></td>
  </tr>
  <!-- 新增 开始 by pipiguang-->
  <tr>
  <td class="hback">
    <div align="right">锁定栏目</div>
  </td>
    <td width="78%" class="hback">
    <select name="isLockClass" id="isLockClass">
      <option value="0" selected>不锁定</option>
      <option value="1">锁定</option>
    </select>
    <span class="tx">如果栏目不选择,并锁定栏目,标签输出网站根栏目导航</span>
    </td>
  </tr>
  <!-- 新增 结束 -->

  <tr>
  <td class="hback">
    <div align="right">输出格式</div>
  </td>
  <td class="hback">
    <select name="out_char" id="out_char" >
    <option value="out_Table">普通格式</option>
    <option value="out_DIV">DIV+CSS格式</option>
   
    </select>
  </td>
  </tr>
  <tr class="hback"  id="div_id" style="font-family:宋体;display:none;" >
  <td rowspan="3"  align="center" class="hback">
    <div align="right"></div>
    <div align="right">DIV控制</div>
  </td>
  <td colspan="3" class="hback" ><div id="
    <input name="DivID"  type="text" id="DivID" size="6" disabled style=" border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="前台生成DIV调用的ID号,请在CSS中预先定义。不能为空">
    " class="
    <input name="Divclass"  type="text" id="Divclass" size="6"  style=" border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="前台生成DIV调用的Class名称,请在CSS中预先定义。可以为空!!">
    "> <span class="tx">对生成列表进行定位,样式控制,ID定义</span></td>
  </tr>
  <tr class="hback" id="ul_id" style="font-family:宋体;display:none;">
  <td colspan="3" class="hback" ><ul id="
    <input name="ulid"  type="text" id="ulid" size="6" style=" border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000"  title="前台生成ul调用的ID,请在CSS中预先定义。可以为空!!">
    " class="
    <input name="ulclass"  type="text" id="ulclass" size="6"  style=" border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="前台生成ul调用的class名称,请在CSS中预先定义。可以为空!!">
    "> <span class="tx">对生成列表进行定位,样式控制,ID定义</span></td>
  </tr>
  <tr class="hback"  id="li_id" style="font-family:宋体;display:none;">
  <td colspan="3" class="hback" ><li id="
    <input name="liid"  type="text" id="liid" size="6"  style=" border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="前台生成li调用的ID,请在CSS中预先定义。可以为空!!">
    " class="
    <input name="liclass"  type="text" id="liclass" size="6"  style=" border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000"  title="前台生成li调用的class名称,请在CSS中预先定义。可以为空!!">
    "> <span class="tx">对生成列表进行定位,样式控制,ID定义</span></td>
  </tr>
  <tr>
  <td class="hback">
    <div align="right">排列方式</div>
  </td>
  <td class="hback">
    <select name="cols"  id="cols">
    <option value="0" selected>横向</option>
    <option value="1">纵向</option>
    </select>
  </td>
  </tr>
  <tr>
  <td class="hback">
    <div align="right">标题CSS</div>
  </td>
  <td class="hback">
    <input  name="Titlecss" type="text" id="Titlecss" size="12" >
  </td>
  </tr>
  <tr>
  <td class="hback">
    <div align="right">标题导航</div>
  </td>
  <td class="hback">
    <label>
    <input name="TitleNavi" type="text" id="TitleNavi" value="·">
    请使用html语法</label>
  </td>
  </tr>
  <tr>
  <td class="hback">
    <div align="right"></div>
  </td>
  <td class="hback">
    <input name="button2" type="button"  value="确定创建此标签">
    <input name="button2" type="button"  value=" 取 消 ">
  </td>
  </tr>
</table>
<script language="JavaScript" type="text/JavaScript">
function ok(obj)
{
  var retV = '{FS:NS=ClassNavi┆';
  retV+='输出方式$' + obj.out_char.value + '┆';
  retV+='栏目$' + obj.ClassID.value + '┆';
  retV+='方向$' + obj.cols.value + '┆';
  retV+='DivID$' + obj.DivID.value + '┆';
  retV+='Divclass$' + obj.Divclass.value + '┆';
  retV+='ulid$' + obj.ulid.value + '┆';
  retV+='ulclass$' + obj.ulclass.value + '┆';
  retV+='liid$' + obj.liid.value + '┆';
  retV+='liclass$' + obj.liclass.value + '┆';
  retV+='标题CSS$' + obj.Titlecss.value + '┆';
  retV+='标题导航$' + obj.TitleNavi.value + '┆';
  //新增 开始
  retV+='锁定栏目$' + obj.isLockClass.value + '';
  //新增 结束

  retV+='}';
  window.parent.returnValue = retV;
  window.close();
}
</script>
<%end sub%>

NS_Public.asp

80行左右
    '修改 开始 ubound(f_array)<>11 -> ubound(f_array)<>12
    case "classnavi"
      if ubound(f_array)<>12  then:get_LableChar="标签错误":else:get_LableChar=ClassNavi(f_Lablechar,"classnavi",f_Id):end if
    '修改 结束




  '栏目导航____________________________________________________________________
  Public Function ClassNavi(f_Lablechar,f_type,f_Id)
  '{FS:NS=ClassNavi┆输出方式$out_DIV┆栏目$┆方向$0┆DivID$topmenu┆Divclass$┆ulid$┆ulclass$┆liid$┆liclass$┆标题CSS$┆标题导航$·┆锁定栏目$1}
  dim ClassId,cols,titlecss,rs,ClassNavistr,ParentIDstr,cols_str,div_tf,table_array
  dim classNews_head,classNews_bottom,classNews_middle1,classNews_middle2,cssstyle,titleNavi
  table_array=split(f_Lablechar,"┆")
  ClassId = split(split(f_Lablechar,"┆")(2),"$")(1)
  cols = split(split(f_Lablechar,"┆")(3),"$")(1)
  titlecss = split(split(f_Lablechar,"┆")(10),"$")(1)
  if instr(f_Lablechar,"out_DIV")>0 then
    div_tf = 1
    cssstyle = ""
  else
    div_tf=0
    if titlecss<>"" then
    cssstyle = " Class="""& titlecss &""""
    else
    cssstyle = ""
    end if
    titleNavi = split(split(f_Lablechar,"┆")(11),"$")(1)
  end if
  if div_tf=1 then
    classNews_head = table_str_list_head(div_tf,split(table_array(4),"$")(1),split(table_array(5),"$")(1),split(table_array(6),"$")(1),split(table_array(7),"$")(1))
    classNews_middle1 = table_str_list_middle_1(div_tf,split(table_array(8),"$")(1),split(table_array(9),"$")(1))
  else
    classNews_head = "<table border=""0"" cellspacing=""0"" cellpadding=""3"" width=""100%"">"
  end if
  classNews_bottom = table_str_list_bottom(div_tf)
  classNews_middle2 = table_str_list_middle_2(div_tf)
 
  '修改 开始
  dim isLockClass:isLockClass=split(split(f_Lablechar,"┆")(12),"$")(1)
  if isLockClass<>"0" and isLockClass<>"1" then
    isLockClass="0"
  end if
  if trim(ClassId)="" then
    ClassId="0"
  end if
 
  dim ParentID
  if isLockClass="0" then
    if f_id<>"" then
    ParentID=f_id
    else
    ParentID="0"
    end if
  else
    ParentID=ClassId
  end if
  ParentIDstr = " and ParentId = '"& ParentID&"'"
  '修改 结束
 
  set rs = Conn.execute("select ClassID,OrderID,ClassName,isShow,ParentID,ReycleTF From FS_NS_NewsClass where isShow=1 and ReycleTF=0 "& ParentIDstr &" Order by OrderId desc,id asc")
  ClassNavistr = ""
  if rs.eof then
    ClassNavistr = ""
    rs.close:set rs=nothing
  else
    do while not rs.eof
    if div_tf=1 then
      ClassNavistr = ClassNavistr &classNews_middle1 & titleNavi & "<a href="""&get_ClassLink(rs("ClassId"))&""">"&rs("ClassName")&"</a>" & classNews_middle2
    else
      if cols="0" then
      cols_str = " "
      else
      cols_str = "<br />"
      end If
      If ClassNavistr="" And cols = "0" Then
      ClassNavistr = titleNavi & "<a href="""&get_ClassLink(rs("ClassId"))&""""& cssstyle&">"&rs("ClassName")&"</a>"& cols_str &""
      Else
      ClassNavistr = ClassNavistr & titleNavi & "<a href="""&get_ClassLink(rs("ClassId"))&""""& cssstyle&">"&rs("ClassName")&"</a>"& cols_str &""
      End If
    end if
    rs.movenext
    loop
    rs.close:set rs=nothing
    if div_tf=1 then
    ClassNavistr=classNews_head & ClassNavistr & classNews_bottom
    end if
  end if
  ClassNavi = ClassNavistr
  End Function
本帖被评分 1 次
引用
 

回复:栏目导航改进,增加根栏目导航锁定功能

此功能不错,多谢分离,如果其他朋友需要加入此功能的话,需要修改标签,不然会出现标签错误.
FoosunCMS操作流程:创建栏目-->添加新闻-->添加样式-->创建标签-->将标签插入模板-->生成首页栏目页完成.
引用
 

回复:栏目导航改进,增加根栏目导航锁定功能

要支持一下
引用
 

回复:栏目导航改进,增加根栏目导航锁定功能

能不能把修改好的文家发上啦呀
引用
 
1  /  1  页   1 跳转

版权所有 Foosun.NET  NewsCMS.com  NewsIDC.COM  Sitemap

Powered by Discuz!NT 2.0.1115    Copyright © 2001-2008 Comsenz Inc.
Processed in 0 second(s) (Cached).
返顶部