Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-25 16:17:00

roelof
Member
Registered: 2005-03-27
Posts: 647

pagination problem

I try to make a pagination for my site.
With the plugins i now i can’t get it as i want it.
So i was thinking of this way.

Counting the pages of a particular month.
Making a loop where the url is made with the page number.
In pseudo code.

Aantal = count (pagenumbers of a month)
For teller = 1 to aantal http://<site_url>/c=<category1>/month=<posted month>/page=aantal.
end.

Can this be done with txp tags or do i have to use php for this ?

Roelof

Offline

#2 2008-09-26 14:29:02

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: pagination problem

hello,

I think that another way can do it but the question stays how can i count th articles of a particular month ?

Roelof

Offline

#3 2008-09-27 13:33:01

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: pagination problem

hello,

I found that a plugin can do the job.
But what’s wrong with this code.

$out .= ‘<a href=<txp:site_url />?c=’<txp:category1 />’&pg=’.$i.’” title=“Page ‘.$i.’”>’.$i.’</a>’;

Roelof

Offline

#4 2008-09-27 13:43:00

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: pagination problem

You can’t mix PHP code with TXP tags like that. This should work better (hard to tell for sure without known the rest of the code):

$out .= '<a href="'.site_url(array()).'?c='.category1(array()).'&pg='.$i.'" title="Page '.$i.'">'.$i.'</a>';

Last edited by ruud (2008-09-27 15:37:17)

Offline

#5 2008-09-27 13:55:38

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: pagination problem

ruud wrote:

You can’t mix PHP code with TXP tags like that…

Remember to put empty array() inside functions that have $atts or you get errors…

In example category1() that ruud said, should be category1(array()) and so on.

Offline

#6 2008-09-27 14:36:26

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: pagination problem

Thank you,

I wil try it.

Roelof

Edit

I made this code of it :
$out .= $out .= ‘<a href=”’.site_url(array()).’?c=’.category1(array()).’&pg=’.$i.’” title=“Page ‘.$i.’”>’.$i.’</a>’;
but it doesn’t work.

Second question :

I want to have &month=<tpx:posted> between the category and the page.
Is this then correct : $out .= $out .= ‘<a href=”’.site_url(array()).’?c=’.category1(array()).&month=.month(array()).’&pg=’.$i.’” title=“Page ‘.$i.’”>’.$i.’</a>’;

Last edited by roelof (2008-09-27 14:50:55)

Offline

#7 2008-09-27 15:38:20

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: pagination problem

“doesn’t work” can be a valid reason for posting, but it’s not enough for anyone here to give advice on how to solve the problem.

Offline

#8 2008-09-27 16:53:08

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: pagination problem

Hay Ruud,

That’s a pity.
I have a problem. I get help here.
You and Gocom give me a answer but something is that answer is not correct.
I asked therefore to help me what went wrong.

Roelof

Offline

#9 2008-09-29 07:36:52

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: pagination problem

I installed version 4.0 of the rsx_page plugin.
If anyone can tell me how to out the month in the url
in this piece of code ($url = ($c != ‘’) ? ‘&c=’.$c : ‘’;) i will be a very happy man.

Roelof

Offline

#10 2008-09-30 13:59:02

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: pagination problem

I can’t find an rsx_page plugin anywhere. The question is difficult to answer without knowing how that plugin works. The month is only known in individual article context. Pagination usually happens in article list context.

Offline

#11 2008-09-30 14:56:20

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: pagination problem

Hello Ruud,

You can find the plugin here : http://www.lalabobo.net/rsx_page_number.

Groetjes,

Roelof

Offline

#12 2008-09-30 15:08:39

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: pagination problem

$month has no meaning in the context where that plugin operates, so I don’t see a way to add a $month (assuming you don’t want it set to the current month at all times) to the URL it outputs.

Offline

Board footer

Powered by FluxBB