Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2010-02-20 12:45:19
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els,
De last one if we are on page 8.
<txp:article pgonly="1" limit="1" /><!-- om de foutmelding dat er geen article tag is te voorkomen, doet verder niets -->
<txp:if_section name="default">
<txp:variable name="monthpage" value='<txp:page_url type="month" />' /> **** Month : 2005 -09 *****
<txp:variable name="pagenumber" value='<txp:page_url type="pg" />' /> ***** 8 *******
<txp:variable name="category" value='<txp:page_url type="c" /> '/> **** zwangerschap ******
<txp:variable name="totpages" value='<txp:article_custom category=''<txp:category />'' month=''<txp:page_url type="month" />'' sort="Posted desc" limit="1"><txp:custom_field name="pagenr" /></txp:article_custom>' />
***** VAR:TOTPAGES : 17 ***********
<txp:variable name="firstpage" value="0" />
**** VAR:FIRSTPAGE : 0 ********************
<!-- check if we're on a monthly archive page or not -->
<txp:if_variable name="monthpage" value=""> **** FALSE *******
<!-- no, this is the frontpage -->
<txp:article_custom section="voorpagina" form="default" />
<txp:else />
<txp:article_custom month='<txp:page_url type="month" />' section="articles" category='<txp:page_url type="c" />' pagenr='<txp:if_variable name="pagenumber" value="">1<txp:else /><txp:page_url type="pg" /></txp:if_variable>' limit="999" form="dagboek" sort="Posted asc" /> **** artikelen plaatsen *****
<!-- pagination -->
<txp:smd_if field="txpvar:totpages" operator="ge" value="11"> TRUE
ALS ER 11 OF MEER PAGINA'S ZIJN
<txp:smd_if field="urlvar:pg,urlvar:pg" operator="ge,lt" value="4,8">
** is true wat niet klopt. dus le veranderen in lt ***** FALSE
<txp:variable name="firstpage" value='<txp:variable name="pagenumber" />' />
VAR:FIRSTPAGE WORDT HUIDIGE PAGINANUMMER
<txp:adi_calc name="firstpage" subtract="2" />
VAR:FIRSTPAGE WORDT HUIDIGE PAGINANR. -/- 2
<txp:variable name="lastpage" value='<txp:variable name="firstpage"/>' />
VAR:LASTPAGE = HUIDIGE PAGINANR. -/- 2
<txp:adi_calc name="lastpage" add="10"/>
VAR:LASTPAGE WORDT HUIDIGE PAGINANUMMER -/- 2 + 10
</txp:smd_if>
<txp:smd_if field="urlvar:pg" operator="ge,not" value="8">
<txp:variable name="firstpage" value="6" /> **** VAR Firstpage : 6 ******
VAR:FIRSTPAGE WORDT 6
<txp:variable name="lastpage" value="17"/> ***** VAR Lastpage : 17 *********
VAR:LASTPAGE WORDT 17
</txp:smd_if>
<txp:smd_if field="urlvar:pg" operator="lt,not" value="4"> ***** FALSE ********
<txp:variable name="firstpage" value="1" />
VAR:FIRSTPAGE WORDT 1
<txp:variable name="lastpage" value="11"/>
VAR:LASTPAGE WORDT 11
</txp:smd_if>
<txp:smd_if field="urlvar:pg" operator="undefined"> ***** FALSE *******
ALS ER GEEN PAGINANR. IS (EERSTE PAGINA)
<txp:variable name="firstpage" value="1" />
VAR:FIRSTPAGE WORDT 1
<txp:variable name="lastpage" value="11"/>
VAR:LASTPAGE WORDT 11
</txp:smd_if>
Samenvatting :
Totpages : 17
paginanummer : 8
firstpage : 6
lastpage : 17
Roelof
Last edited by roelof (2010-02-20 12:52:14)
Offline
#17 2010-02-20 12:53:01
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els,
This part of the script works now good according to my dry-runs.
Can you confirm this ?
Roelof
Offline
#18 2010-02-20 17:06:40
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: pagination problem
Hi Roelof, I don’t have time to look into it thoroughly right now. A couple of things I notice:
- when you’re on page 9 or higher there are tag errors about
<txp:variable name="lastpage" />, it looks like it’s not set on those pages <txp:variable name="pagenumber" />most of the time doesn’t give the current page number- there is still a tag error about
<txp:variable name=paginanummer />, it needs quotes
Offline
#19 2010-02-20 17:32:57
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els,
I changed the if_different tag to the old situation.
And changed the errors that i found.
So I think I solved all errors.
Roelof
Offline
#20 2010-02-21 10:42:52
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
hello Els,
I think why the pagination part is not working for sept.
I have two variables nl. custom field pagenr and the corrected pagenr.
So I think I have to use two <txp:if_different> so I have to look carefully where to put it.
Roelof
Offline
#21 2010-02-21 11:10:47
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: pagination problem
That’s what I thought ;)
My guess is that you put too many tags inside the if_different tags.
Offline
#22 2010-02-21 11:16:42
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Oke,
So I have to look for a answer to this problem.
Will be difficult.
Do you have any tips.
Roelof
Offline
#23 2010-02-21 12:26:11
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hoi,
I think I know another way but then I have to store all the pagenumbers somewhere.
Roelof
Offline
#24 2010-02-21 14:27:33
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: pagination problem
roelof wrote:
I have to store all the pagenumbers somewhere.
Depending on how you need to store them (in a list or separately) I think you can do that using article_custom, if_different and <txp:custom_field name="pagenr"/>.
Offline
#25 2010-02-21 14:32:21
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els.
My thoughts were this to solve it.
To get all pagenr and store it.
Then to look if the total pages > 11
If so : only get the numbers which are needed from the stored pagenr.
And make the url’s.
If not so : take all the pagenr and make the urls
Roelof
Offline
#26 2010-02-21 20:28:42
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello,
Nobody who can tell me if this idea can work ?
Roelof
Offline
#27 2010-02-21 21:06:57
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: pagination problem
roelof wrote:
Nobody who can tell me if this idea can work ?
Not as long as I don’t get the idea, especially this part:
only get the numbers which are needed from the stored pagenr.
It’s not difficult to get the page numbers (you’re already doing that in the pagination), but how are you going to determine which ones you need?
To be honest, if it were my site I’d have given up by now and used a css solution.
Offline
#28 2010-02-21 21:12:52
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els.
What i meant was this :
Lets say all the pagenumbers are in a sort of table named pagenumbers.
With the script we have debugged we can determine with which numbers we have to start variable : firstpage and where to stop : variable lastpage.
So i only want to display the numbers of that table which are between that two numbers. The numbers included.
I think i can do that which the plugin smd-each together with smd-if.
Roelof
Offline
#29 2010-02-21 21:53:26
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: pagination problem
roelof wrote:
I think i can do that which the plugin smd-each together with smd-if.
Well, the only way to find out is to give it a go ;) I admire your perseverance, but I think it’s an awful lot of trouble for a minor part of a site…
Offline