Results 1 to 6 of 6

Thread: Next/Prev display trick

  1. #1
    Join Date
    Dec 2008
    Posts
    31

    Default Next/Prev display trick

    I noticed that even when there was only one page of search results, the next/prev pager was still being displayed. This looked a little silly so I looked at the conditional tags for that template and made this:

    Code:
    <!--hide pager block if only one page of results - wrap in div with display:none-->
    {nextprev_is_firstpage_block}
      {nextprev_lastpage_block}
        <div class="hide_pager">
      {/nextprev_lastpage_block}
    {/nextprev_is_firstpage_block}
    Which has the effect of only displaying the div if the results are the first page AND the last page, which is the same as saying the ONLY page.

    After the pager I put something similar:

    Code:
    {nextprev_is_firstpage_block}
      {nextprev_lastpage_block}
        </div><!--end hide_pager-->
      {/nextprev_lastpage_block}
    {/nextprev_is_firstpage_block}
    Which closes the div if the same condition exists.

    The class "hide_pager" is just display:none.

    You can see it at work here:

    http://apm.dreamhosters.com/index.php

    If you click Residential and Search (15 results), you see the pager. If you click Commercial and Search (2 results), the pager is hidden.

    Now, the more observant here may ask: why didn't you just wrap the pager in the conditional tags and dispense with the wrapping div? I tried that. Man, did I try it. But for some reason enclosing all the other next/prev template tags in that conditional messed up the code. Dunno why, but this solution works.

  2. #2
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Next/Prev display trick

    IMO, smart tip. Congrats!
    But I don't like the idea of "display:none".

    You could open a feature request so O-R DEV's may consider to implement it by default.

    Eduardo

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  3. #3
    Join Date
    Dec 2008
    Posts
    31

    Default Re: Next/Prev display trick

    Eduardo, I was going to write an addon that did the same thing, but putting it in core would be even better.

    I asked about permission tags here...

    http://support.open-realty.org/showthread.php?t=22293

    ...but as yet haven't had a reply.

    Why not display:none? What's the alternative?

    That said, I've got the impression that the whole paging setup in OR is not as good as it could be. One thing that is quirky is the blocks of 10 pages (which actually malfunctions, but a bug report has been opened about that I think).

    Edit: opened request: http://www.open-realty.org/featurere...md=view&id=558

  4. #4
    Join Date
    Feb 2009
    Location
    Miami Beach
    Age
    38
    Posts
    89

    Default Re: Next/Prev display trick

    Quote Originally Posted by Nuwanda View Post
    Eduardo, I was going to write an addon that did the same thing, but putting it in core would be even better.

    I asked about permission tags here...

    http://support.open-realty.org/showthread.php?t=22293

    ...but as yet haven't had a reply.

    Why not display:none? What's the alternative?

    That said, I've got the impression that the whole paging setup in OR is not as good as it could be. One thing that is quirky is the blocks of 10 pages (which actually malfunctions, but a bug report has been opened about that I think).

    Edit: opened request: http://www.open-realty.org/featurere...md=view&id=558
    Very nice and useful tip.

    Perhaps I missed something though. Why would you want to put it in an addon or in the core when css does the job? I have always been taught the simplest approach that does the job is the most elegant.

  5. #5
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Next/Prev display trick

    Quote Originally Posted by Nuwanda View Post
    ...but putting it in core would be even better.
    That's why I recommended to open a ticket at Feature Area.

    Quote Originally Posted by Nuwanda View Post
    I asked about permission tags here...
    http://support.open-realty.org/showthread.php?t=22293
    ...but as yet haven't had a reply.
    Not even from me you are going to have a reply (for now), once it would require from me a time to search for an answer. Time that I don't have right now.


    Quote Originally Posted by Nuwanda View Post
    Why not display:none? What's the alternative?
    Just because I don't like it. Google don't like either. IMO, the alternative is to have it implemented at the O-R core.


    Quote Originally Posted by Nuwanda View Post
    That said, I've got the impression that the whole paging setup in OR is not as good as it could be. One thing that is quirky is the blocks of 10 pages (which actually malfunctions, but a bug report has been opened about that I think).
    That's why we have the Feature Area and the Bug Tracker. Those are the places for people to post suggestions (and the most important IMO: with solutions!) about O-R.
    At the Forum, it is REALLY not nice to read "complaints". Should be "this way" or should be "that way"... IMHO, should be kept far away from the Forum. IMO, it is "lamentation" that takes nobody to nowhere. When I see people posting this way at the Forum, I just ignore them.


    Eduardo

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  6. #6
    Join Date
    Dec 2008
    Posts
    31

    Default Re: Next/Prev display trick

    Well, a simple template tag would be more semantic (cleaner, more meaningful) than my CSS kludge.

    Quote Originally Posted by Aden View Post
    Very nice and useful tip.

    Perhaps I missed something though. Why would you want to put it in an addon or in the core when css does the job? I have always been taught the simplest approach that does the job is the most elegant.

Similar Threads

  1. Next - Prev
    By table_for_me in forum General Help (CLOSED)
    Replies: 19
    Last Post: 11-16-2009, 11:11 PM
  2. Cool CSS trick for Forms <-- Must see
    By nycbrokerfreedotcom in forum Templates - Help/Ideas/Discussion (CLOSED)
    Replies: 1
    Last Post: 03-03-2009, 05:00 AM
  3. How to use Prev Next Icons
    By nedrom in forum Templates - Help/Ideas/Discussion (CLOSED)
    Replies: 5
    Last Post: 11-15-2007, 09:09 AM
  4. Replies: 1
    Last Post: 12-21-2006, 01:33 PM
  5. <prev ... next> for the viewusers.php
    By iceman in forum HELP (CLOSED)
    Replies: 1
    Last Post: 04-23-2004, 08:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •