Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Toni Becker 146 posts 425 karma points
    Aug 01, 2011 @ 16:53
    Toni Becker
    0

    Trying to create Pagination

    Okay i've got it to the point where it's counting and so on but if i click the Link site stays blank:

    Here's the code for now:

    @using System.Linq
    @using System.Xml.Linq
    @using umbraco.MacroEngines
    @using uBlogsy.Web.Extensions
    @using uBlogsy.Web.Helpers

    @{
    DynamicNodeList artikelListe = Model.AncestorOrSelf(1).DescendantsOrSelf("uBlogsyPost");

    //Hole Tags, Kategorien, Authoren und Suchbegriffe
    var tag = Request.QueryString["tag"];
    var category = Request.QueryString["category"];
    var author = Request.QueryString["author"];
    var searchTerm = Request.QueryString["search"];
    List<DynamicNode> nodes = NodeHelper.GetPosts(tag, category, author, searchTerm, artikelListe.Items).Where(x=>x.NodeTypeAlias=="uBlogsyPost").OrderBy(x=>x.GetProperty("uBlogsyPostDate").Value).ToList();
    int pageSize = 6;
    int page = 1;
    int totalNodes = nodes.Count();
    int totalPages = (int)Math.Ceiling((double)totalNodes / (double)pageSize);

    if ( page > totalPages) {
    page = totalPages;
    }
    else if ( page < 1){
    page = 1;
    }


    }
    @if(@Parameter.Small == "1")
    {
    foreach(dynamic n in nodes.Skip((page-1) * pageSize).Take(pageSize))
    {
    var anleser = umbraco.library.StripHtml(n.uBlogsyContentBody.ToString());
    var crop = @n.artikelBild.Find("@name","Archiv Post").url;

    <li>
    <div class="image">
    <a href="@n.Url"><img src="@crop" alt="archive full pic"></a>
    </div><!--image-->
    <div class="details">
    <h5><a href="@n.Url">@n.uBlogsyContentTitle</a></h5>
    <span class="date"></span>
    <p>@MyHelpers.Truncate(anleser, 200)</p>
    </div>
    <div class="clear"></div>
    </li>
    }
    <ul>
    @for (int p =1; p < totalPages + 1; p++){
    string selected = (p == page) ? "selected" : String.Empty;
    <li class="@selected"><a href="@landing?page=@p">@p</a></li>
    }

    </ul>

    }

Please Sign in or register to post replies

Write your reply to:

Draft