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的头部和底部样式代码删除
随机推荐
- linux添加修改用户名密码
语 法: useradd [-mMnr][-c <备注>][-d <登入目录>][-e <有效期限>][-f <缓冲天数>][-g <群组> ...
- A beginner’s guide to Cache synchronization strategies--转载
原文地址:http://vladmihalcea.com/2015/04/20/a-beginners-guide-to-cache-synchronization-strategies/ Intro ...
- DebugView图文教程
Debug信息捕获软件. 可以很方便的捕获系统实时输出的Debug信息,并保存为日志文件.可以远程捕获服务器上的Debug信息. 比较方便开发人员在系统发布前监控一些系统流程和异常,甚至在系统不大的情 ...
- android scrollview主要的问题
项目做多了之后,会发现其实 ScrollView嵌套ListVew或者GridView等很常用,但是你也会发现各种奇怪问题产生.根据个人经验现在列出常见问题以及代码最少最简单的解决方法. 问题一 : ...
- [课程相关]homework-01
我的github博客大概是一年前创建的.现在已经想不起来当时是怎么接触到github的了,大概是从某一个网站看到的吧.注册完帐号以后很长一段时间都没有真正的去使用github,主要原因就是网站是英文的 ...
- 1045 | error connecting to master 'slave_user@192.168.0.75:3306' - retry-time: 6
mysql 主从复制问题整理 问题: 1045 | error connecting to master 'slave_user@192.168.0.75:3306' - retry-t ...
- jboss使用(eap 6.0以后版本)
以6.3版本为例,下载地址 https://www.jboss.org/products/eap/download/,这个地址现在有问题了,下不了好像要redhat账号还要花钱?不知咋回事 下载完成后 ...
- Hibernate悲观锁/乐观锁
如果需要保证数据访问的排它性,则需对目标数据加"锁",使其无法被其它程序修改 一,悲观锁 对数据被外界(包括本系统当前的其它事务和来自外部系统的事务处理)修改持保守态度,通过数据库 ...
- Scala中的构造器和高阶函数
构造器 在定义类时可以定义主构造器.主构造器可以同时声明字段. /** * 主构造器 * @author Administrator */ //在scala中,类和方法交织在一起 class Test ...
- 关于JDK中的集合总结(三)
泛型: jdk1.5出现的安全机制. 好处: 1,将运行时期的问题ClassCastException转到了编译时期. 2,避免了强制转换的麻烦. <>:什么时候用?当操作的引用数据类型不 ...