using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; using PlugNT.Common;
using PlugNT.Cms.Custom;
using PlugNT.Cms.Model;
using PlugNT.Cms.BLL;
using PlugNT.Cms.Page;
using PlugNT.Cms.Utility; public partial class _Newsinfo : SitePager
{ protected int artId = ;
protected string prevlink = "";
protected string nextlink = "";
//资讯模型数据
protected DataRow drInfo = null;
protected void Page_Load(object sender, EventArgs e)
{
//id为1的资讯模型
int sysModelId = ;
//或者根据栏目id调用模型
//int sysModelId = Channel.GetSysModelId(1);
int.TryParse(Request["id"] as string, out artId);
if (artId==)
{
PageHelper.ShowError(this.Context, "参数错误!");
return;
} Article bllArticle = new Article();
drInfo = bllArticle.GetDataRow(sysModelId, artId);
if (drInfo == null)
{
PageHelper.ShowError(this.Context, "查看的内容不存在!");
return;
} //点击数加1
ArticleInfo info = new ArticleInfo();
info.id = artId;
info.SetExtField("hits", Type_Field.integerType, "hits+1");
bllArticle.UpdateData(sysModelId, info); //上一页
string[] arrPrevLink = Article.GetArray(sysModelId, "id,title", " and id<" + artId + " and [channel_id]=" + drInfo["channel_id"].ToString() + " order by id desc");
if (arrPrevLink == null)
{
prevlink = "没有了";
}
else
{
//获取真实字符数
int lenLink=Utils.GetStringLength(arrPrevLink[]);
string strLink=lenLink>?Utils.CutLenString(arrPrevLink[],)+"...":arrPrevLink[];
prevlink = string.Format("<a href='/newsinfo.aspx?id={0}' title='{1}'>{2}</a>", arrPrevLink[], arrPrevLink[], strLink);
} //下一页
string[] arrNextLink = Article.GetArray(sysModelId, "id,title", " and id>" + artId + " and [channel_id]=" + drInfo["channel_id"].ToString() + " order by id asc");
if (arrNextLink == null)
{
nextlink = "没有了";
}
else
{
//获取真实字符数
int lenLink = Utils.GetStringLength(arrNextLink[]);
string strLink = lenLink > ? Utils.CutLenString(arrNextLink[], ) + "..." : arrNextLink[];
nextlink = string.Format("<a href='/newsinfo.aspx?id={0}' title='{1}'>{2}</a>", arrNextLink[], arrNextLink[], strLink);
} } }

PlugNT CMS v4.6.3 调用文章上一页和下一页及点击数加1的更多相关文章

  1. PlugNT CMS v4.6.3 最新功能

    PlugNT CMS v4.6.3 最新功能: 弃用标签 selected="commend,stick" 改为andwhere="commend=1 and stick ...

  2. GridView自定义分页样式(上一页,下一页,到第几页)

    今天要为网站做一个文章列表,发现GridView的分页样式很难看,于是结合网上的例子,自己做了一个.不是很美观,不过还是很实用的,先看下效果吧,如图(1). 图(1)GridView分页效果 自定义G ...

  3. 2016/3/27 分页 共X条数据 本页x条 本页从x-y条 x/y页 首页 上一页 123456 下一页 末页 pagego echo $page->fpage(7,6,5,4,3,2,1,0);

    显示效果: fpage.class.php <?php /** file: page.class.php 完美分页类 Page */ class Page { private $total; / ...

  4. 原生JS实现分页效果2.0(新增了上一页和下一页,添加当前元素样式)

    虽然写的很烂,但至少全部都是自己写的,因为这个没有固定的顺序,所以就没有封装,如果你技术好的话,可以你写的分享给我,谢谢. <!DOCTYPE html><html lang=&qu ...

  5. 分页-jquery.page.js插件在使用时重复触发“上一页”和“下一页”操作

    HTML代码 <!-- <div class="zxf_pagediv" id="Pagination" style="display:b ...

  6. linux more 上一页,下一页

    linux more 上一页,下一页 使用more命令可以分页查看内容: 如: more install.txt 分页查看文本内容: 按回车:默认下一行数据: 按空格键盘,默认下一页,以当前屏幕为单位 ...

  7. Blog上一页和下一页的功能

    博客上一页和下一页的功能 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

  8. jquery.page.js插件在使用时重复触发“上一页”和“下一页”操作

    jquery.page.js使用demo HTML代码 <div class="result"> <div class="tcdPageCode&quo ...

  9. 自定义 Swiper 的上一页,下一页按钮

    1. Swiper 的上一页,下一页按钮,不是必需包含在container 中的 2. 定义上一页,下一页按钮的样式,CSS略.... 3. 在初始化Swiper中,定义上一页,下一页按钮

随机推荐

  1. docker镜像打包save,载入load,启动run

    docker打包,针对的是镜像,而不是运行中的容器. 查看当前系统的镜像文件:docker images 将当前运行中的,已经自定义修改后的容器保存为新的镜像. docker commit ce11e ...

  2. 不得不提的volatile及指令重排序(happen-before)

    微信公众号[程序员江湖] 作者黄小斜,斜杠青年,某985硕士,阿里 Java 研发工程师,于 2018 年秋招拿到 BAT 头条.网易.滴滴等 8 个大厂 offer,目前致力于分享这几年的学习经验. ...

  3. Hadoop学习笔记(二):简单操作

    1. 启动namenode和datanode,在master上输入命令hdsf dfsadmin -report查看整个集群的运行情况(记得关闭防火墙) 2. 输入命令查看hadoop监听的端口,ne ...

  4. Leetcode 1-10

    这篇文章介绍Leetcode1到10题的解决思路和相关代码. 1. Two sum 问题描述:给定一个整数数组,返回两个数字的索引,使它们加起来等于一个特定的目标. 例子: Given nums = ...

  5. 【转载】红外遥控HS0038B接法

        4.7uF电容的作用:去耦和旁路   去耦电容的主要功能就是提供一个局部的直流电源给有源器件,以减少开关噪声在板上的传播和将噪声引导到地.通常也把输出信号的干扰作为滤除对象. 旁路电容:为高频 ...

  6. 【Linux】基于VMware搭建Linux系统

    本篇文章侧重于操作,主要内容大致包括: 两大类操作系统简要介绍 VMware Workstation Pro 15简要介绍及安装 CentOS简要介绍及基于Wi'n'dows 操作系统的安装 一 关于 ...

  7. linux磁盘管理增加,扩容

    一.磁盘空间不足,添加新的磁盘 一般来说,当我们在服务上插入新的磁盘时,服务器是会对磁盘进行识别的.但是,有的时候服务器并没有对这些新插入的磁盘进行识别.这时,我们可以通过重启服务器,来使服务器重新加 ...

  8. “每日一道面试题”.Net中所有类的基类是以及包含的方法

    闲来无事,每日一贴.水平有限,大牛勿喷. .Net中所有内建类型的基类是System.Object毋庸置疑 Puclic Class A{}和 Public Class A:System.Object ...

  9. IIS Tomcat共享80端口

    为什么有这种需求, 原因是这样的, 公司有一个Java的web项目,在另一台服务器A上,最近老板一时兴起,想把他合并到这台稳定点的服务器B上,服务器B上使用IIS来寄宿asp.net 网站, 怎么办呢 ...

  10. ASP.NET Core入门

    一.搭建开发环境 在Windows平台下,开发.NET Core 程序需要安装如下内容: 1. .NET Core runtime 2. Visual Studio 2015 with Update ...