解决博易2.0版分页问题

今天更新了博客程序,我使用的是博易博客www.blogyi.net,从1.9升级到了2.0。升级完成后,发现了一个小问题,2.0的分页出现了问题

 少了一个2对吧!

没办法只能改源码了。

1.找到BlogYi.Net-2.0-Source.zip\BlogEngine\BlogEngine.NET\App_Code\Controls\PostPager.cs打开

找到

// always show last two

                //pages.Add(total - 1);//by Spoony

                pages.Add(total);

大概在145行
改为

// always show last two

                pages.Add(total - 1);//by Spoony

                //pages.Add(total);


我觉得可能是作者Spoony太粗心注释错了。这里改回Spoony写的就可以了。

2.下面的改动不是必须的,但个人觉得这样改比较妥。因为不改这一块,当翻页到最后一页的时候,最后一页的页码是不显示的。翻页到第一页第一页的页面是箭头,不是很对称。
211行找到

if (currentPage == 1)

                {

                    //retValue += string.Format(LinkDisabled, labels.nextPosts);

                    retValue += string.Format(LinkDisabled, "<<");//by Spoony

                }


改为

if (currentPage == 1)

                {

                    //retValue += string.Format(LinkDisabled, labels.nextPosts);

                    retValue += string.Format(LinkDisabled, "1");//by Spoony

                }


再找到249行

if (currentPage == pagesTotal)

                {

                    //retValue += string.Format(LinkDisabled, labels.previousPosts);

                    retValue += string.Format(LinkDisabled, ">>");//by Spoony

                }


改为

if (currentPage == pagesTotal)

                {

                    //retValue += string.Format(LinkDisabled, labels.previousPosts);

                    retValue += string.Format(LinkDisabled, pagesTotal);//by Spoony

                }


然后重新编译更新上传服务器即可

 

正常了。

你可能感兴趣的:(分页)