Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2010-02-20 09:31:58
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els.
Oke,
I will dry run this script with the numbers 1, 4, 8, and 9 and hope I can see where the problem is.
One thing I saw was that the controle of firstpage=0 can be deleted.
I will report back to you.
Roelof
Offline
#14 2010-02-20 11:20:38
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els,
If im on page 1 everything is working well.
See this :
<txp:if_section name="default">
<txp:variable name="monthpage" value='<txp:page_url type="month" />' /> **** Montpage = 2005 - 09 *****
<txp:variable name="pagenumber" value='<txp:page_url type="pg" />' /> **** pagenumber = 1 *******
<txp:variable name="category" value='<txp:page_url type="c" /> '/> ***** Category = 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" /> **** Post alle articles **********
<!-- pagination -->
<txp:smd_if field="txpvar:totpages" operator="ge" value="11"> ***** TRUE **********
<txp:smd_if field="urlvar:pg,urlvar:pg,txpvar:firstpage" operator="ge,le,not" value="4,8,0"> **** 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,txpvar:firstpage" operator="ge,not" value="8,0"> **** FALSE *******
ALS 1. HUIDIGE PAGINANR. GROTER DAN OF GELIJK AAN 8 (DIT OVERLAPT MET DE EERSTE: KLEINER DAN OF GELIJK AAN 8)
EN 2. VAR:FIRSTPAGE (= HUIDIGE PAGINANR. - 2) NIET GELIJK AAN 0
=> HUIDIGE PAGINAR. NIET GELIJK AAN 2
??? DENK NIET DAT DE TWEEDE ZO BEDOELD IS ???
<txp:variable name="firstpage" value="6" />
VAR:FIRSTPAGE WORDT 6
<txp:variable name="lastpage" value="17"/>
VAR:LASTPAGE WORDT 17
</txp:smd_if>
<txp:smd_if field="urlvar:pg,txpvar:firstpage" operator="le,not" value="4,0"> ***** TRUE ******
<txp:variable name="firstpage" value="1" /> ******* Var : Firstpage : 1 *******
<txp:variable name="lastpage" value="11"/> ******* var : lastpage : 11 *******
</txp:smd_if>
<txp:smd_if field="urlvar:pg" operator="undefined"> FALSE
<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
Firstpage : 1
Lastpage : 11
En dat klopt.
Roelof
Last edited by roelof (2010-02-20 11:27:27)
Offline
#15 2010-02-20 11:54:40
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination problem
Hello Els,
If Im on page 4 there is a problem.
<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" />' /> **** 2005-09 ****
<txp:variable name="pagenumber" value='<txp:page_url type="pg" />' /> ****** 4 ******
<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 geplaatst *******
<!-- 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,txpvar:firstpage" operator="ge,le,not" value="4,8,0"> **** TRUE ******
**** firstpage is altijd 0 dus dat gedeelte kan verwijdert worden.
<txp:variable name="firstpage" value='<txp:variable name="pagenumber" />' /> **** VAR Firstpage = 4
VAR:FIRSTPAGE WORDT HUIDIGE PAGINANUMMER
<txp:adi_calc name="firstpage" subtract="2" /> **** VAR firstpage = 2 ******
VAR:FIRSTPAGE WORDT HUIDIGE PAGINANR. -/- 2
<txp:variable name="lastpage" value='<txp:variable name="firstpage"/>' /> ***** VAR lastpage = 2
VAR:LASTPAGE = HUIDIGE PAGINANR. -/- 2
<txp:adi_calc name="lastpage" add="10"/> *** VAR lastpage = 12
VAR:LASTPAGE WORDT HUIDIGE PAGINANUMMER -/- 2 + 10
</txp:smd_if>
<txp:smd_if field="urlvar:pg,txpvar:firstpage" operator="ge,not" value="8,0"> **** FALSE ******
<txp:variable name="firstpage" value="6" />
VAR:FIRSTPAGE WORDT 6
<txp:variable name="lastpage" value="17"/>
VAR:LASTPAGE WORDT 17
</txp:smd_if>
<txp:smd_if field="urlvar:pg,txpvar:firstpage" operator="le,not" value="4,0">
**** true, klopt niet, dus le veranderen in lt dan 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>
Samenvating :
paginanummer : 4
totpages : 17
firstpage : 2
lastpage : 12
This is now correct.
Roelof
Last edited by roelof (2010-02-20 12:04:19)
Offline
#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