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会员中心添加新页面-会员投稿,获得所有文章并分页的更多相关文章

  1. DTCMS会员中心添加新页面

    首先将模板文件spend_list.html放到模板文件夹 URL配置里 将需要在此页面传递的参数,在“添加表达式”中配置好 链接写法: 继承类名DTcms.Web.UI.Page.spend_lis ...

  2. ruoyi前后端分离版:添加新页面,不需登录也可访问

    添加QRcode页面代码 <template> <div class="register"> <el-form ref="registerF ...

  3. 在开源UOJ的导航栏中添加新页面链接

    前言 刚用开源UOJ搭建OJ成功时就想在导航栏那里添加一个站内页面链接,无奈当时乱搞水平低,网上也没有教程,不晓得怎么弄 今天突然来了闲情乱搞一通,结果还真乱搞成了...特意写下为后来人少走点弯路 前 ...

  4. Ecstore 会员中心 菜单添加一项

    1.会员中心 添加菜单 ecstore_合并支付总结_会员中心添加菜单_20160113 class : b2c_ctl_site_member (图 1)     第一步: (图1)         ...

  5. Drupal8开发教程:模块开发——创建新页面

    之前我们已经通过<Drupal8开发教程:认识.info.yml文件>对模块的YAML文件有了了解,今天我们来看如何通过模块开发的方式添加一个新的页面. 在 Drupal 7 中,通过模块 ...

  6. ecshop 添加后台页面以及设置权限

    转自 http://blog.csdn.net/tgh1981/article/details/10394059 ecshop 添加新页面 给ecshop后台增加管理功能页面 比如我们增加一个统计报表 ...

  7. (8)Flask微电影项目会员中心其他页面搭建

    会员中心修改密码.评论.登录日志和收藏电影4个页面的内容. 一.修改密码页面: {% extends "home/home.html" %} {% block css %} < ...

  8. (7)Flask微电影之会员中心页面搭建

    一.添加会员中心页面的路由 修改app/home/views.py内容,追加会员有关的5个路由: # coding:utf8 from . import home from flask import ...

  9. DTCMS会员中心快速更改样式思路

    非常简便 制作一个public.css文件,包含网站头部和底部的样式代码 每个会员中心模版导入这个文件就可以 把原先style.css的头部和底部样式代码删除

随机推荐

  1. 解析“extern”

    解析“extern” 1. 声明外部变量 现代编译器一般採用按文件编译的方式,因此在编译时,各个文件里定义的全局变量是 互相透明的,也就是说,在编译时,全局变量的可见域限制在文件内部.以下举一个简单的 ...

  2. Xtrabackup每周增量备份脚本程序

    Xtrabackup每周增量备份脚本程序(含附件)   程序描述 本程序是一个对percona xtrabackup使用的脚本,它完成了MySQL每周的备份. 程序结构 此程序包含了4个目录(bin. ...

  3. .Net中JS调用后台的方法

    前台方法: <script type="text/jscript"> var k = "test"; var s = '<%=ShowMsg( ...

  4. C++_归并排序

    //合并有序数组 //合并例子 void MemeryArray(int a[], int n, int b[],int m, int c[]) { int i,j,k; i=j=k=0; while ...

  5. Sky number

    描述 key 天生对数字特别敏感,一次偶然的机会,他发现了一个有趣的四位数2992,这个数,它的十进制数表示,其四位数字之和为2+9+9+2=22,它的十六进 制数BB0,其四位数字之和也为22,同时 ...

  6. HTTP协议理解

    HTTP(Hyper Text Transfer Protocol)超文本传输协议,是一种请求响应式协议,类似两国会晤中需要遵守的规则.那么,其中有什么内容特点呢? HTTP特点: 1)支持客户端/服 ...

  7. 沈逸老师PHP魔鬼特训笔记(2)

    一.这一课会学习到几个懒人函数: 1.file_put_contents (PHP 5, PHP 7) file_put_contents — 将一个字符串写入文件 说明 int file_put_c ...

  8. [课程相关]homework-04

    零.准备工作 这次的作业仍然是结对编程,我们队伍的成员为:梁杰.夏天晗.谢祖三.上次我们是选择了一个时间大家聚在一起进行编程,效果不错,所以这次我们还是决定采用这种方式.由于大家平时比较忙,这周六日我 ...

  9. 自动化中的PageObject思想

    谈着这个话题很大,因为我自己在自动化分层的方面做的就不是很好,最近在做java+selenium中,如果不分层去管理,代码就显得很乱,如下: 下面代码主要是做了一个登录,登录后在修改自己的一些个人信息 ...

  10. (转).net项目技术选型总结

    原文作者:mcgrady 原文地址:.net项目技术选型总结 做.net开发已经几年了,也参与开发了很多大大小小的项目,所以现在希望总结出一套开发.net项目的常用技术,也为以后做项目技术选型的时候作 ...