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. NumPy 学习笔记(二)

    数组索引: 1.ndarray对象的内容可以通过索引或切片来访问和修改,与 Python 中 list 的切片操作一样:   由于数组可能是多维的,所以必须为数组的每个维度指定一个切片,使用切片时返回 ...

  2. 神经网络架构PYTORCH-几个概念

    使用Pytorch之前,有几个概念需要弄清楚. 什么是Tensors(张量)? 这个概念刚出来的时候,物理科班出身的我都感觉有点愣住了,好久没有接触过物理学的概念了. 这个概念,在物理学中怎么解释呢? ...

  3. feh: linux终端下看图片的好工具

    1) 普通浏览 $ feh * 可以察看当前目录下的所有图片,以及当前子目录里的所有图片 2) 播放幻灯片 (-D)   $ feh -D 2 *.jpg 对所有jpg以幻灯片的方式播放,每两秒放一张 ...

  4. shell编程其实真的很简单(一)

    如今,不会Linux的程序员都不意思说自己是程序员,而不会shell编程就不能说自己会Linux.说起来似乎shell编程很屌啊,然而不用担心,其实shell编程真的很简单. 背景 什么是shell编 ...

  5. Vue 中是如何解析 template 字符串为 VNode 的?

    在接触 React 时候,我只了解到通过 babel 可以把 JSX 转成 VNode(通过调用 React.createElement 方法),但是对其具体是如何转换的却不了解. 很明显,回答失败. ...

  6. MngoDb MongoClientOptions 配置信息及常用配置信息

    MongoClientOptions.Builder addClusterListener(ClusterListener clusterListener)Adds the given cluster ...

  7. 插头dp初探

    问题描述 插头dp用于解决一类可基于图连通性递推的问题.用插头来表示轮廓线上的连通性,然后根据连通性与下一位结合讨论进行转移. 表示连通性的方法 与字符串循环最小表示不同,这种方法用于给轮廓线上的联通 ...

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

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

  9. mysql 开发进阶篇系列 42 逻辑备份与恢复(mysqldump 的完全恢复)

    一.概述 在作何数据库里,备份与恢复都是非常重要的.好的备份方法和备份策略将会使得数据库中的数据更加高效和安全.对于DBA来说,进行备份或恢复操作时要考虑的因素大概有如下: (1) 确定要备份的表的存 ...

  10. 项目ITP(三) 玩玩 服务端 到 app端

    前言 系列文章:[传送门] 泡泡脚,写写博客,规律生活,睡个好觉,待会看会书. 正文 上面讲了二维码生成,及 手机端扫一扫,大家有兴趣去看看. 今天我们讲一下,百度云推送平台. 每天想着问题,问题只会 ...