Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2010-01-29 20:29:22
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination and menu problem [solved]
Hello,
I got a little bit closer to the solution. But i can’t get the ul which has to surround the <li> of the months on the right place.
What I got is this :
<div id="navigation">
<ul id="topnav">
<txp:article_custom category='<txp:variable name="menu2" />' wraptag="li" break="" sortdir="asc" limit="999">
<txp:if_different>
<li> <a href="<txp:site_url />?c=Category2&month=<txp:posted format="%Y-%m" />"><txp:posted format="%b" /></a>
</li>
</txp:if_different>
</txp:article_custom>
</txp:category_list>
</ul>
anyone knows how to handle this one ?
Roelof
Offline
Re: pagination and menu problem [solved]
You have a closing </txp:category_list> tag inside your <ul id="topnav">, but no opening tag. Where is it?
It looks like you could use wraptag="ul" break="li" in your article_custom tag instead of writing out the ul and li tags by hand.
Put your site into debug mode to make sure you aren’t getting any Txp errors.
Code is topiary
Offline
#18 2010-01-29 21:00:03
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination and menu problem [solved]
Hello jsoo.
Thank you for the tip.
This looks a little bit better.
Now figure out why they are empty <li> </li>.
When I go to the debug mode I get this message : Textpattern Notice: sortdir attribute is deprecated on line 678
Roelof
Roelof
Offline
Re: pagination and menu problem [solved]
roelof wrote:
Now figure out why they are empty <li> </li>.
My mistake: go back to using wraptag="li" break="" and add the surrounding ul tags by hand. Then get ride of the li tags inside the if_different block.
When I go to the debug mode I get this message : Textpattern Notice: sortdir attribute is deprecated on line 678
Change sortdir="asc" to sort="Posted asc" in the article_custom tag.
Last edited by jsoo (2010-01-29 21:19:10)
Code is topiary
Offline
#20 2010-01-29 21:23:04
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination and menu problem [solved]
Hello Jsoo,
When I do that we have the same problem as before.
When I set the <ul> before the article_custom tag then i will appear on the wrong place.
When I do it after that tag you will see that every <li> will be surrounded by the ul – tag.
Roelof
Offline
Re: pagination and menu problem [solved]
OK, eventually I may make a correct suggestion :-0
Forget about the wraptag and break attributes — leave those out. Now I see that wraptag="li" generates an li whether or not if_different produces any output. So you need to put the li tags inside the if_different, as you had it originally.
I don’t know where the extra ul is coming from. It’s not in the code you posted.
Code is topiary
Offline
#22 2010-01-29 21:46:11
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination and menu problem [solved]
Hello Jsoo.
I didn;t put it now.
But it works if you leave out the break and put the <li> inside the if-different.
But I see a lot of empty lines now.
Roelof
Offline
Re: pagination and menu problem [solved]
roelof wrote:
I see a lot of empty lines now.
If you want to get rid of those you’ll have to remove most of the line breaks inside your article_custom tag.
You still have an extra opening ul tag.
Also, you have two uls with the same id value, which won’t validate.
Code is topiary
Offline
#24 2010-01-30 08:27:11
- roelof
- Member
- Registered: 2005-03-27
- Posts: 647
Re: pagination and menu problem [solved]
Helllo jsoo,
Thank you.
But yesterday i made a thinking error.
I try to use categories and subcategories but txp can’t handle subcategories.
So can this work.
Category : Baby tijd.
Section : 1e levensjaar, 2e levensjaar.
After that the months.
So first read all the categories, after that read all the sections of that category and after that read all the posted months of that section.
Roelof
Offline
#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