Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#25 2010-02-03 19:29:47
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination and menu problem [solved]
Hello .
Together with Els we came to a solution.
For the menu we use this :
<ul id="topnav">
<li><a href="<txp:site_url />" class="home">Home</a></li>
<!-- niveau 1: alleen de categorieën die zelf geen parent hebben, en niet de child-categories, dus alleen 'zwangerschap', 'babytijd' enz.: -->
<txp:category_list parent="" children="0" break="li" exclude="voorpagina">
<!-- voor elk van deze parent categorieën de titel: -->
<a href="#" class="<txp:category />"><txp:category title="1" /></a>
<div class="sub">
<!-- en (niveau 2) de child-categorieën voor deze parent (jaar1, jaar2 enz.): -->
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="" break="ul"><!-- let op: break="" is nodig, als je het weglaat krijg je <br />s -->
<!-- voor elk van deze child-categorieën de titel: -->
<li><h2><a href="#"><txp:category title="1" /></a></h2></li>
<!-- en (niveau 3) de maanden in deze child-categorie -->
<txp:article_custom sort="Posted asc" category='<txp:category />' break="" limit="999">
<txp:if_different>
<li><a href="/?c=<txp:category />&month=<txp:posted format="%Y-%m" />"><txp:posted format="%B %Y" /></a></li>
</txp:if_different>
</txp:article_custom>
</txp:category_list>
</div>
</txp:category_list>
</ul>
and for the articles we use this :
<txp:if_section name="default">
<txp:variable name="monthpage" value='<txp:page_url type="month" />' />
<txp:variable name="pagenumber" value='<txp:page_url type="pg" />' />
<txp:variable name="category" value='<txp:page_url type="c"/> />
<!-- check if we're on a monthly archive page or not -->
<txp:if_variable name="monthpage" value="">
<!-- 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" />
<!-- pagination -->
<txp:variable name="meerdan1pagina" value='<txp:article_custom section="articles" month=''<txp:page_url type="month" />'' pagenr="2" limit="1" />' />
<!-- als er tenminste één artikel op pagina 2 staat, is er meer dan 1 pagina -->
<ul><txp:article_custom month='<txp:page_url type="month" />' section="articles" sort="custom_1 + 0 asc, posted asc" limit="99">
<txp:if_variable name="meerdan1pagina" value="">
<!-- geen artikel op pagina 2, dus is er maar 1, dus laten we paginanr. niet zien -->
<txp:else />
<txp:if_different>
<li><a href="?month=<txp:page_url type="month" />&pg=<txp:custom_field name="pagenr" />"><txp:custom_field name="pagenr" /></a> </li>
</txp:if_different>
</txp:if_variable>
</txp:article_custom></ul>
</txp:if_variable>
</txp:if_section>
Roelof
Offline