DTcms会员中心添加新页面-会员投稿,获得所有文章并分页
DAL.article.cs
/// <summary>
/// 自定义:获得查询分页数据
/// </summary>
public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * FROM " + databaseprefix + "article"); if (strWhere.Trim() != "")
{ strSql.Append(" where " + strWhere); }
recordCount = Convert.ToInt32(DbHelperSQL.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
return DbHelperSQL.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, pageIndex, strSql.ToString(), filedOrder));
}
BLL.article.cs
/// <summary>
/// 自定义:获得查询分页数据
/// </summary>
public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
{
return dal.GetList(pageSize, pageIndex, strWhere, filedOrder,out recordCount);
}
DTcms.Web.UI\Label\article.cs
/// <summary>
/// 自定义:文章分页列表(自定义页面大小)
/// </summary>
/// <param name="page_size">页面大小</param>
/// <param name="page_index">当前页码</param>
/// <param name="strwhere">查询条件</param>
/// <param name="orderby">排序</param>
/// <param name="totalcount">总记录数</param>
/// <returns>DateTable</returns>
protected DataTable get_article_list( int page_size, int page_index, string strwhere, out int totalcount)
{
DataTable dt = new DataTable(); dt = new BLL.article().GetList(page_size, page_index, strwhere, " sort_id asc,add_time desc", out totalcount).Tables[]; return dt;
}
DTcms.Web.UI\Page下新建user_article.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Web;
using DTcms.Common; namespace DTcms.Web.UI.Page
{
public partial class user_article : Web.UI.UserPage
{
protected int page; //当前页码
protected int totalcount; //OUT数据总数
/// <summary>
/// 重写虚方法,此方法将在Init事件前执行
/// </summary>
protected override void InitPage()
{
page = DTRequest.GetQueryInt("page", );
}
}
}
模版文件:templates\main下新建user_article.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文章管理 - {site.name}</title>
<meta name="keywords" content="{site.seo_keyword}" />
<meta name="description" content="{site.seo_description}" />
<link href="<%templateskin%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%templateskin%>/css/public.css" rel="stylesheet" type="text/css" />
<link href="<%templateskin%>/css/index.css" rel="stylesheet" type="text/css" /> <link href="{config.webpath}css/pagination.css" rel="stylesheet" type="text/css" />
<link href="{config.webpath}scripts/artdialog/ui-dialog.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="{config.webpath}scripts/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{config.webpath}scripts/artdialog/dialog-plus-min.js"></script>
<script type="text/javascript" charset="utf-8" src="<%templateskin%>/js/common.js"></script>
<script type="text/javascript">
function ExecPostBack(checkValue) {
if (arguments.length == 1) {
ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_address_delete', checkValue, '#turl');
}else{
var valueArr = '';
$("input[name='checkId']:checked").each(function(i){
valueArr += $(this).val();
if(i < $("input[name='checkId']:checked").length - 1){
valueArr += ","
}
});
ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_address_delete', valueArr, '#turl');
}
}
</script>
</head> <body>
<!--Header-->
<%template src="_header.html"%>
<!--/Header--> <div class="section clearfix">
<div class="line30"></div> <div class="info-wrap">
<!--左侧导航-->
<%template src="_ucenter_nav.html"%>
<!--/左侧导航--> <!--右侧内容-->
<div class="home-box">
<!--收货地址列表-->
<div class="u-tab-head">
<p>
<a class="selected" href="<%linkurl("user_article")%>">文章管理</a>
</p>
<span> </span>
</div>
<div class="u-tab-content">
<div class="title-div">
<strong>我的文章管理</strong>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ftable">
<tr>
<th width="30">选择</td>
<th align="left">标题</td>
<th width="18%" align="left">状态</td>
<th width="20%" align="left">时间</td>
<th width="100">操作</td>
</tr>
<%set DataTable list=get_article_list(15, page, " user_name='"+userModel.user_name+"'", out totalcount)%><!--取得一个DataTable-->
<%set string pagelist=get_page_link(15, page, totalcount, "user_article", "__id__")%> <!--取得分页页码列表-->
<%foreach(DataRow dr in list.Rows)%>
<tr>
<td width="20" align="center">
<input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" >
</td>
<td>
{dr[title]}
</td>
<td></td>
<td></td>
<td align="center">
编辑 </td>
</tr>
<%/foreach%>
<%if(list.Rows.Count==0)%>
<tr><td colspan="5" align="center">暂无记录...</td></tr>
<%/if%>
</table>
<div class="page-foot">
<div class="flickr right">{pagelist}</div><!--放置页码列表-->
<div class="page-btns">
<a onclick="checkAll(this);" href="javascript:;">全选</a>
<span class="pipe">|</span>
<a onclick="ExecPostBack();" href="javascript:;">删除</a>
</div>
</div>
</div>
<input id="turl" type="hidden" value="<%linkurl("user_article")%>" /><!--存在跳转的URL值-->
<!--/收货地址列表-->
</div>
<!--/右侧内容-->
</div>
</div> <!--Footer-->
<%template src="_footer.html"%>
<!--/Footer-->
</body>
</html>
页面中关键html代码
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ftable">
<tr>
<th width="30">选择</td>
<th align="left">标题</td>
<th width="18%" align="left">状态</td>
<th width="20%" align="left">时间</td>
<th width="100">操作</td>
</tr>
<%set DataTable list=get_article_list(15, page, " user_name='"+userModel.user_name+"'", out totalcount)%><!--取得一个DataTable-->
<%set string pagelist=get_page_link(15, page, totalcount, "user_article", "__id__")%> <!--取得分页页码列表-->
<%foreach(DataRow dr in list.Rows)%>
<tr>
<td width="20" align="center">
<input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" >
</td>
<td>
{dr[title]}
</td>
<td></td>
<td></td>
<td align="center">
编辑 </td>
</tr>
<%/foreach%>
<%if(list.Rows.Count==0)%>
<tr><td colspan="5" align="center">暂无记录...</td></tr>
<%/if%>
</table>
在系统设置-URL配置
最终效果
DTcms会员中心添加新页面-会员投稿,获得所有文章并分页的更多相关文章
- DTCMS会员中心添加新页面
首先将模板文件spend_list.html放到模板文件夹 URL配置里 将需要在此页面传递的参数,在“添加表达式”中配置好 链接写法: 继承类名DTcms.Web.UI.Page.spend_lis ...
- ruoyi前后端分离版:添加新页面,不需登录也可访问
添加QRcode页面代码 <template> <div class="register"> <el-form ref="registerF ...
- 在开源UOJ的导航栏中添加新页面链接
前言 刚用开源UOJ搭建OJ成功时就想在导航栏那里添加一个站内页面链接,无奈当时乱搞水平低,网上也没有教程,不晓得怎么弄 今天突然来了闲情乱搞一通,结果还真乱搞成了...特意写下为后来人少走点弯路 前 ...
- Ecstore 会员中心 菜单添加一项
1.会员中心 添加菜单 ecstore_合并支付总结_会员中心添加菜单_20160113 class : b2c_ctl_site_member (图 1) 第一步: (图1) ...
- Drupal8开发教程:模块开发——创建新页面
之前我们已经通过<Drupal8开发教程:认识.info.yml文件>对模块的YAML文件有了了解,今天我们来看如何通过模块开发的方式添加一个新的页面. 在 Drupal 7 中,通过模块 ...
- ecshop 添加后台页面以及设置权限
转自 http://blog.csdn.net/tgh1981/article/details/10394059 ecshop 添加新页面 给ecshop后台增加管理功能页面 比如我们增加一个统计报表 ...
- (8)Flask微电影项目会员中心其他页面搭建
会员中心修改密码.评论.登录日志和收藏电影4个页面的内容. 一.修改密码页面: {% extends "home/home.html" %} {% block css %} < ...
- (7)Flask微电影之会员中心页面搭建
一.添加会员中心页面的路由 修改app/home/views.py内容,追加会员有关的5个路由: # coding:utf8 from . import home from flask import ...
- DTCMS会员中心快速更改样式思路
非常简便 制作一个public.css文件,包含网站头部和底部的样式代码 每个会员中心模版导入这个文件就可以 把原先style.css的头部和底部样式代码删除
随机推荐
- php的分表分库类
<?php include 'config.php'; class Model{ //用户名 protected $user; //密码 protected $pwd; //主机 protect ...
- S_ISREG等几个常见的宏 struct stat
S_ISLNK(st_mode):是否是一个连接.S_ISREG(st_mode):是否是一个常规文件.S_ISDIR(st_mode):是否是一个目录S_ISCHR(st_mode):是否是一个字符 ...
- focuskye 学习及下载
学习:http://www.focusky.com.cn/tutorials/ 下载:http://www.focusky.com.cn/download/
- C#_自动化测试1_模拟post,get_12306火车票网站自动登录工具
还记得2011年春运,12306火车票预订网站经常崩溃无法登录吗. 今天我们就开发一个12306网站自动登录软件. 帮助您轻松订票 通过前两篇博客Fiddler教程和HTTP协议详解,我们了解了Web ...
- AJAX XMLHttpRequest
<html> <head> <title>XMLHTTPRequest对象的说明DEMO</title> <script language=&qu ...
- python(7)–类的多态实现
第一步: 先定义三个类: class Animal: def __init__(self, name): self.name = name #这个方法的意思是,如果继承该类,就得自己写talk方法,如 ...
- hdu 4671 瞎搞
题意:每个用户对数据库的查询请求都会首先用该数据库的服务器序列的第一个去执行任务,若第一个坏了,就由第二个执行.最多只会坏一个服务器.要求是考虑最多坏一个的情况下,所有服务器中执行用户查询的数目最大值 ...
- poj 2449 第k短路径
思路: 利用一个估计函数g[i]=dis[i]+len.其中len为队列出来的点当前已经走了的距离.dis[i]为该点到终点的最短路径.这样我们只要将点按g[i]的升序在队列你排序,每次取出最小的g[ ...
- less-2
样式内嵌: 生成css: 样式运算: 生成的css文件:
- Android--仿QQ侧滑菜单
首先还是先看一下效果图吧,这个示例在网上能找到很多,我主要在此是做一个小结和一些代码的分析,当是自己在学习过程中的一个积累,因为网上同样的文章很多,所以也无法探究最初的来源是哪里了. 我们可以从效果图 ...