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的头部和底部样式代码删除
随机推荐
- 面向对象设计原则OO
面向对象设计原则是OOPS(Object-Oriented Programming System,面向对象的程序设计系统)编程的核心,但大多数Java程序员追逐像Singleton.Decorator ...
- C++的64位整数
在做ACM题时,经常都会遇到一些比较大的整数.而常用的内置整数类型常常显得太小了:其中long 和 int 范围是[-2^31,2^31),即-2147483648~2147483647.而unsig ...
- 用PC浏览器模拟手机浏览器(一):无扩展版
想浏览手机版,打开对应网址却跳转到PC版?怎么办? 下面咱们来说下在只是安装了浏览器,无需其他安装操作的情况下来怎么用PC浏览器模拟手机浏览器,然后访问手机站点. 浏览器众多,IE系列的咱就不考虑了, ...
- 把旧的项目改变名称重新部署到tomcat下发现项目名称还是原来的项目名称,解决方案
选中项目右键点击properties 在type file text 中输入web 选择web在右边可以看到web-context-root 把里面的项目名称改成你最新的就ok了
- 浅谈xss攻击
近期学习过程中提到xss攻击的问题,便想要了解一下,总结如下: XSS攻击:跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets, ...
- Android(java)学习笔记83:finally关键字的作用
package cn.itcast_07; import java.text.ParseException; import java.text.SimpleDateFormat; import jav ...
- ResponseBody的使用
使用Spring的@ResponseBody有时还是挺方便的,在ajax调用返回纯字符串时有中文编码问题. @ResponseBody @RequestMapping(value="/dec ...
- Linux系统上安装软件(JDK以及tomcat服务器)
一:安装jdk linux系统上面如果运行java程序,就需要安装java的运行环境(jdk) 1:下载linux版本的jdk 地址:http://www.oracle.com/technetwork ...
- Windows 8.1 归档 —— Step 1 选择与安装
下面是 Windows 8.1 各版本区别: Windows 8.1 标准版(一般就称之为Windows 8.1): 包括全新的 Windows 商店.Windows 资源管理器.任务管理器等等,还将 ...
- saltstack实战4--综合练习2
Saltstack配置管理-功能模块-安装haproxy 配置管理,我们分了3层 最底层是系统初始化部分 倒数二层是功能模块,就是具体的产品的安装了 假如你的环境需要nginx,php,memcach ...