Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Apr 18, 2013 @ 15:07
    Biagio Paruolo
    0

    How to display posts from some categories

    This is my workaround:

    var tuttiposts = new List<DynamicNode>();

    var nodescategories = PostService.Instance.GetPosts(Model.Id);

            foreach (var n in nodescategories)

            {

                allCategories.AddRange(n.uBlogsyPostCategories.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries));

            }

            // get only distinct categories

            IEnumerable<string> elencocategorie = allCategories.Distinct();          

            if (elencocategorie.Count() > 0){                 

                        foreach (var c in elencocategorie)

                        {

                            if ((!string.IsNullOrEmpty(c.Trim())) && (c!="News"))

                            {

                              var posts1 = PostService.Instance.GetPosts(Model.Id, tag, c, author, searchTerm, commenter, page-1, count);

         tuttiposts.AddRange(posts1);  

                            }

                        }

              }

     var orderedposts = tuttiposts.OrderByDescending(x => x.GetPropertyValue("uBlogsyPostDate")).Distinct().Take(count);

       @foreach (DynamicNode n in orderedposts)   

            {

             ...........

             }

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies