Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
please help with monthly archive/navigation issue
I’ve had this issue for a long time.
I use the month query string value for archiving old blog posts.
This was how I used to use txp older and newer under the list of posts on my blog page
<txp:article form="blogpostlist" limit="20" />
<txp:if_article_list>
<p align="center"><txp:newer >< Next </txp:newer> | <txp:older >Previous ></txp:older ></p>
</txp:if_article_list>
The problem with this is if someone was browsing by month the month variable would be lost from the query string when they clicked that link. So you might be looking at April 2006 from the sidebar link but when you clicked previous you’d be going to page 2 of the default blog view (no month parameter).
Just now I tried to do an ugly hack at this using txp:php to grab the month value and add it as needed.
<txp:article form="blogpostlist" limit="20" />
<txp:if_article_list>
<p align="center"><a href="<txp:newer /><txp:php>if ($_GET['month'] != "") { if ($_GET['pg'] == 2) { echo ("?month=" . $_GET['month']);} else { echo ("&month=" . $_GET['month']);} }</txp:php>">< Next </a> | <a href="<txp:older /><txp:php>if ($_GET['month'] != "") { echo ("&month=" . $_GET['month']);}</txp:php>">Previous ></a></p>
</txp:if_article_list>
This actually works well for forming the url’s. The problem is since I’ve incorporated the txp:newer and txp:older tags into an <a href> tag they lose the ability to not show up when they’re not needed. So the last page of the month still has a previous link and the 1st page still has the newer link.
I didn’t see a conditional for is_previous or is_newer but anyway there has got to be a better way to do this.
See the url
http://www.ohword.com/blog/?month=2007-01 for an example of what I’m talking about. This has the new version where the month is retained but we have unnecessary Next/Previous links on the first and last page.
Thanks for your help!
Offline
Re: please help with monthly archive/navigation issue
anyone have any ideas?
Offline
#3 2007-02-13 19:11:09
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: please help with monthly archive/navigation issue
A bug, now fixed in svn.
Offline