private void bindShow(ContentPost post, DataPage <ContentImg> imgPage) { ctx.SetItem("ContentPost", post); set("post.Title", post.Title); set("post.Content", post.Content); set("post.CreateTime", post.Created); set("post.ReplyCount", post.Replies); set("post.Hits", post.Hits); set("post.Source", post.SourceLink); if (post.Creator != null) { set("post.Submitter", string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", Link.ToMember(post.Creator), post.Creator.Name)); } else { set("post.Submitter", "нч"); } IBlock block = getBlock("list"); foreach (ContentImg img in imgPage.Results) { block.Set("img.Url", img.GetImgUrl()); block.Set("img.Description", img.Description); block.Next(); } String postLink = alink.ToAppData(post); String pageBar = ObjectPage.GetPageBarByLink(postLink, imgPage.PageCount, imgPage.Current); set("page", pageBar); }
private String getPagedContent(ContentPost post, String pageSeparator) { String content; string[] ss = { pageSeparator }; string[] arrContent = post.Content.Split(ss, StringSplitOptions.None); int currentPage = ctx.GetInt("cp"); int pidx = currentPage - 1; if (pidx < 0) { pidx = 0; } content = arrContent[pidx]; content = strUtil.CloseHtml(content); content += ObjectPage.GetPageBarByLink(alink.ToAppData(post), arrContent.Length, pidx + 1); return(content); }