Home > CMS Tutorial > DEDECMS > How to add search function to the background administrator list in dedecms

How to add search function to the background administrator list in dedecms

藏色散人
Release: 2019-12-10 09:58:42
Original
2419 people have browsed it

How to add search function to the background administrator list in dedecms

dedecms织梦怎么给后台管理员列表增加搜索功能?

最近用织梦系统给一个客户做了一个管理系统,客户分配的管理员账户达到了300多个,搜索起来很不方便,应客户要求要加一个管理员账户搜索功能,其实做起来蛮容易的,修改文件涉及两个,首先打开文件:

推荐学习:织梦cms

1、默认为/dede/templets/sys_admin_user.htm,在合适的位置加入代码:

<form action="sys_admin_user.php" name="form1" method="get">
      <table border="0" cellspacing="0" cellpadding="3">
      <tr>
          <td>管理员搜索:</td>
          <td><input name="keyword" type="text" id="keyword" size="12" style="width:120px" value="{dede:global name=&#39;keyword&#39;/}" /></td>
          <td><input name="imageField" class="np" type="image" src="images/button_search.gif" width="60" height="22" border="0" /></td>
        </tr>
      </table>
      </form>
Copy after login

2、找到/dede/sys_admin_user.php,找到:

else $rank = " WHERE CONCAT(dede_admin.usertype)=&#39;$rank&#39; ";
Copy after login

在这个的下面加入:

if(!isset($keyword)) $keyword = &#39;&#39;;
else $keyword = trim(FilterSearch($keyword));
Copy after login

找到:$query = "SELECT dede_admin.*,dede_arctype.typename FROM dede_admin LEFT JOIN dede_arctype ON dede_admin.typeid = dede_arctype.id $rank ";,修改为:

if($keyword<>&#39;&#39;)
{
$query = "SELECT dede_admin.*,dede_arctype.typename FROM dede_admin LEFT JOIN dede_arctype ON dede_admin.typeid = dede_arctype.id $rank  where userid LIKE &#39;%$keyword%&#39; OR uname LIKE &#39;%$keyword%&#39;";
}
else
{
$query = "SELECT dede_admin.*,dede_arctype.typename FROM dede_admin LEFT JOIN dede_arctype ON dede_admin.typeid = dede_arctype.id $rank ";
}
Copy after login

到这里就完成了,做好了去试下,是不是很好用。

The above is the detailed content of How to add search function to the background administrator list in dedecms. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template