Copied to clipboard

Flag this post as spam?

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


  • Denford 132 posts 323 karma points
    Apr 03, 2013 @ 11:34
    Denford
    0

    Set the number of page links to display in ublogsy

    i have ublogsy 2.1.0.0 installed on a umbraco 4.7.2 site and on my blog landing page i have the pagination set to display 5 items. My problem now is i have 500+ articles and the list of page links has got over 100 page links and looks a bit messy now. Is there a way i can set the pagination links to only display 10 links and have the next and prev links display the next/prev 10 page link or an extra link with pages 10 to 20 and 30 to 40 while displaying page links 20 to 30 kind of function. If not already added to a new version i think this would be a cool feature to add, in the mean time is there a way of archiving this or will i have to "hack in" something.

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 03, 2013 @ 11:58
    Anthony Dang
    0

    This is something that i've been meaning to get around to for a while, but I havent figured out a nice solution. You can do it in js or in c#. I havent really thought about that either.

    If there are N pages, make a list/array and add page 1 and N. That's first and last links so you can jump to the start and end. That's about as far as i've gotten.

    But what should go in the middle 8? And where should the current page sit in the remaining 8?

    What would you suggest?
  • Denford 132 posts 323 karma points
    Apr 03, 2013 @ 12:49
    Denford
    0

    i Have previously used a js plugin to do the pagination http://th3silverlining.com/2010/04/15/pajination-a-jquery-pagination-plugin/ but this relies on all items being loaded first then paginate them after which would mean the page has to load all the articles 1st then paginate them and this would take ages in my case lol.

    So say we have 100 page link and set the link displayed to be 10, the first link will always display 1 to 10 links (default to the 1st page as the current when selected) and the last link display 90 to 100 (default to the 90th page as the current when selected). Then have have a extra prev/next link which will go to the next or prev 10 depending on which page you are on e.g. on page 55 prev will display 40 to 50 and next will display 60 to 70.

    I think the problem would be setting doing this in the razor script without a page reload and maybe using the take/skip to list the nodes on the link click or something along those lines. i dont know if this is entirely do-able and have always used js to do the pagination as it a pain to do it in code. This might help http://cultiv.nl/blog/2011/2/17/how-to-use-razor-in-umbraco-paging/ but because this will have to be built in the ublogsy functionality i havent attempted it yet.

    I will keep you posted on how i get along, might try the js paginate and see how it affects my page load speed.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 03, 2013 @ 13:22
    Anthony Dang
    0

    Definitely do not load all the articles in one go... BAD!

    uBlogsy requires a page load to get the next page of articles. Hiding and showing the relevant page links is the only issue we have to deal with. Can be done in js but better to do it in c#.

    I could never decide on what type of pagination would be nice that would work in all situations.

    Let me know how you go. Maybe it will give me an idea on what may work for everyone.

  • Denford 132 posts 323 karma points
    Apr 03, 2013 @ 14:50
    Denford
    0

    Yes, just discovered that to my cost, the js pagination isnt working using the ublogsyListPost macroscript as it needs the page numbers to go to the and item count so i think i will try and write a separate macroscript  to do the blog listing on the landing page then try the js pagination in there as a quick fix for the time being and will have to load all of them first though i didnt want to do that.

    Ye would be nice to have a dynamic pagination that can be used everywhere using c# or even razor, pass it the items to paginate then spit out the paginated item but unfotunately my coding inst that good hence why i use the js one. Will try and built a new macro to list them and built the Cultiv suggested pagination see where i get with that.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 03, 2013 @ 15:30
    Anthony Dang
    0

    If you're going to do it client side, just hide the page numbers you dont want to show. Don't do anything to the razor script, and avoid loading all the articles in one time.

     

Please Sign in or register to post replies

Write your reply to:

Draft