Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-02-03 13:20:30

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Show pagination form only if articles are more than limit

I have a form that controlls page navigation links.
How can I check if there are more articles than limit?
Can smd_if help me?

Last edited by wornout (2011-02-03 13:20:47)

Offline

#2 2011-02-03 13:33:18

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,256
Website GitHub Mastodon Twitter

Re: Show pagination form only if articles are more than limit

would this tip help?

Edit: just noticed your comment there. I guess not.

What code do you have now?

Last edited by colak (2011-02-03 13:35:12)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2011-02-03 14:10:59

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Show pagination form only if articles are more than limit

Thanks colak!
I simplified the code that is know:

<txp:if_article_list>
<txp:variable name="has_np" value='<txp:older /><txp:newer />' />
<txp:smd_if field="txpvar:has_np" operator="isused"> 
<div id="page-nav">
<txp:soo_page_links window_size="10" wraptag="p" />
</div><!-- #page-nav -->
</txp:smd_if>
</txp:if_article_list>

Offline

#4 2011-02-03 16:00:50

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Show pagination form only if articles are more than limit

soo_page_links has a showalways attribute that, by default, should prevent it from displaying anything if there aren’t extra pages. Is it not working correctly? Or is it only the div tags you’re concerned about?


Code is topiary

Offline

#5 2011-02-03 17:09:49

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Show pagination form only if articles are more than limit

soo_page_numbers works perfectly. I problem was the div
Maybe a form attribute or a container tag could be useful!

Offline

#6 2011-02-03 17:48:26

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Show pagination form only if articles are more than limit

Form or container seems problematic for this, because soo_page_links displays a list — a form would be for formatting individual page links.

I think the solution you’re using is compact enough that making another plugin to cover this case isn’t called for. Note that this would also work:

<txp:if_article_list>
<txp:variable name="has_np" value='<txp:older /><txp:newer />' />
<txp:if_variable name="has_np" value=""><txp:else /> 
<div id="page-nav">
<txp:soo_page_links window_size="10" wraptag="p" />
</div><!-- #page-nav -->
</txp:if_variable>
</txp:if_article_list>

Code is topiary

Offline

#7 2011-02-03 21:00:23

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Show pagination form only if articles are more than limit

It’s true Jeff. I think at the solutions but I don’t know how to do them :-)
However this method is very efficient!
Thanks!

Offline

#8 2011-02-06 21:36:00

Dimitri
Member
From: Johannesburg
Registered: 2010-10-31
Posts: 129

Re: Show pagination form only if articles are more than limit

I dig this

Dunno if that what you need, easy to use. Careful some variables are quite old, check the docs or help to check the updated variables.


<txp:way_too_cool />

Offline

Board footer

Powered by FluxBB