Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
html produced by mini pager:
<li class="pager-previous first"></li>
HTML warning: trimming empty <li>
Comment | File | Size | Author |
---|---|---|---|
#12 | views-minipager-markup-12-345528.patch | 1.38 KB | rvilar |
Comments
Comment #1
jjjames CreditAttribution: jjjames commentedIs that why it forces Safari to NOT use AJAX? When paging through, Safari does a page refresh. Firefox works fine.
Comment #2
Pasqualle@superjames: i do not see a relation with that..
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedChecked in a fix. Will appear in Views 2.3
Comment #5
BWPanda CreditAttribution: BWPanda commentedI upgraded a site that had this issue to latest Drupal and Views 2.3, but still has same problem.
<li class="pager-previous first"> </li>
Seems the fix didn't work...
Comment #6
Pasqualle<li class="pager-previous first"> </li>
is valid HTML, the issue is fixedwhat is the problem?
Comment #7
BWPanda CreditAttribution: BWPanda commentedAh, sorry. I was confusing 'valid' with 'logical'...
If you were just fixing invalid code, then yes it is fixed, but I was referring more to the fact that there's still an empty
<li>
on the page. Wouldn't it be better to just not display that<li>
if there's not real value in it?I only ask as there are some themes I use that put a border around the
<li>'s
in the pager, so they end up displaying an empty box that doesn't look right...Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedThe empty li remains in order to keep everything else from jumping around when the item is not printed. Without it, especially with AJAX on, having the >> and << move around is very awkward.
Comment #10
landscribe CreditAttribution: landscribe commentedJust noting my fix here; removes the empty
<li>'s
:first, unset content of previous/next if empty:
Then only print out previous and next if they are not empty:
This seems to be working ok for my purposes.
Comment #11
Rakward CreditAttribution: Rakward commentedIn what files/functions do I have to implement this code?
Also, I want to modify this if possible, to still display the "<<", but with a css-class to show them in a grey-tone and without the href-function, so people know they cant click it anymore.
Comment #12
rvilarHere is a patch to solve this problem
Comment #13
rvilarAssigned and changed state for review
Comment #14
ecksley CreditAttribution: ecksley commentedThis patch works, thank you.
But until it is applied to Views officially I think it would make more sense to apply this fix on the theme layer so you don't lose it when the module is updated. This way you can also make site specific customizations. IE, I don't use the << & >> arrows. I use an image instead so I can remove those arrows without having to reapply that to the module as it is updated.
Anyway, here is how. In my theme's template.php file I insert the following (pulled mostly from the patched function)
Note to replace the [place_your_theme_name_here] bit with your theme name.
Note I also added a 'mini-pager' div wrapper to the item list the pager generates. Why? This was done so I could achieve that centered look that the empty first and last arrows had previously preserved. After getting help here:
http://www.pmob.co.uk/pob/centred-float.htm
I added the following to my CSS to make it work.:
Were the patch to be rolled into Views I would strongly consider amending it to include the 'mini-pager' div. Without the centering it doesn't look good to the point made earlier by Merlin. Maybe someone else can address that. I've never made a patch. Applying them is hard enough for me.
So, I Hope this post helps someone else as much as you all helped me.
Thanks for Views!
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commenteddereine, can you review this?
Comment #16
dawehnerIf you want to have a most parallel code to the default pager code If(!empty ) should be just an if.
But if it's not needed this code is fine.
One question
Why was this code originally added. Sadly i have no idea.
Comment #17
merlinofchaos CreditAttribution: merlinofchaos commentedThe
are there to keep the pager from jumping around. If you go from page 1 to page 2 (on page 1 you have no previous) without a placeholder there, the spacing on the pager changes. That must be retained for UX reasons.Comment #18
merlinofchaos CreditAttribution: merlinofchaos commentedReading through this, I see that I've explained this previously, but people have ignored it.
Let me state categorically: The empty
<li>
must be retained to prevent the pager from jumping around. The
should be perfectly valid markup.Comment #19
MustangGB CreditAttribution: MustangGB commented