BlogEngine.Web/User controls/PostList.ascx.cs
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
#region Using
using System;
using System.Collections.Generic;
using BlogEngine.Core;
using BlogEngine.Core.Web.Controls;
#endregion
public partial class User_controls_PostList : System.Web.UI.UserControl
{
int _Count;//by Spoony
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsCallback)
{
BindPosts();
InitPaging();
}
}
/// <summary>
/// Binds the list of posts to individual postview.ascx controls
/// from the current theme.
/// </summary>
private void BindPosts()
{
if (Posts == null || Posts.Count == 0)
{
hlPrev.Visible = false;
return;
}
List<IPublishable> visiblePosts = Posts.FindAll(delegate(IPublishable p) { return p.IsVisible; });
int count = Math.Min(BlogSettings.Instance.PostsPerPage, visiblePosts.Count);
int page = GetPageIndex();
int index = page * count;
int stop = count;
if (index + count > visiblePosts.Count)
stop = visiblePosts.Count - index;
if (stop < 0 || stop + index > visiblePosts.Count)
{
hlPrev.Visible = false;
hlNext.Visible = false;
return;
}
string query = Request.QueryString["theme"];
string theme = !string.IsNullOrEmpty(query) ? query : BlogSettings.Instance.Theme;
string path = Utils.RelativeWebRoot + "themes/" + theme + "/PostView.ascx";
int counter = 0;
foreach (Post post in visiblePosts.GetRange(index, stop))
{
if (counter == stop)
break;
后面还有 205 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
