Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-03-31 08:19:04
- K2member
- Member
- Registered: 2006-10-24
- Posts: 19
Show list of months when section is active
Hi there.
For now, when I’m viewing a section/an article inside it, I see the 5 latest articles listet in the sidebar. But I want to have a list of months instead and when I click on a month I want to have all the articles from this month listed in the content.
Can this be done without plugins? / With which plugin can this be done?
Thanks!
Offline
Re: Show list of months when section is active
Have a look at this archive FAQ entry which might help, or try this date tip which uses Mary’s upm_date_menu plugin.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2009-03-31 09:00:30
- K2member
- Member
- Registered: 2006-10-24
- Posts: 19
Re: Show list of months when section is active
Ok, so I will set up an archive page instead of listing the archive in the sidebar.
Offline
Re: Show list of months when section is active
K2member wrote:
Ok, so I will set up an archive page instead of listing the archive in the sidebar.
You can put the archive in the sidebar if you like. Perhaps put the individual article in the main ‘frame’ and the archive in the sidebar; where you position stuff is up to you in your Page template.
Last edited by Bloke (2009-03-31 09:12:57)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2009-03-31 11:02:33
- K2member
- Member
- Registered: 2006-10-24
- Posts: 19
Re: Show list of months when section is active
I chose the first possibility, it seems to be the most accurate one.
My archive_list form looks like this:
<txp:if_different><h2><txp:posted format="%B %Y" /></h2></txp:if_different>
<!-- article title and link -->
<li><txp:permlink><txp:title /></txp:permlink></li>
Of course I need to wrap the <li> in <ul>‘s. I could put the opening <ul>‘s in the if_different conditional but I need to close them, too. Is this possible? (I want to wrap the posts of each month in their own <ul>-tags.)
I need something like an if_first/last_different-tag.
I tried combining if_first_article with if_different:
<txp:if_different>
<txp:if_first_article>
<txp:else /></ul>
</txp:if_first_article>
<h2><txp:posted format="%B %Y" /></h2><ul>
</txp:if_different>
<li><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article><li><txp:permlink><txp:title /></txp:permlink></li></ul></txp:if_last_article>
… resulting in this: http://pyr0rrzzz.pytalhost.de/index.php?s=archiv
Last edited by K2member (2009-03-31 12:25:35)
Offline
#6 2009-03-31 13:01:14
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Show list of months when section is active
K2member wrote:
Of course I need to wrap the <li> in <ul>‘s. I could put the opening <ul>‘s in the if_different conditional but I need to close them, too. Is this possible?
Properly closing list tags using if_different is possible with a workaround (start with an empty set of <ul>
s). It doesn’t look very nice, but it produces valid html.
<txp:if_first_article>
<ul style="display:none;">
</txp:if_first_article>
<txp:if_different>
</ul>
<h2><txp:posted format="%B %Y" /></h2>
<ul>
</txp:if_different>
<li><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article>
</ul>
</txp:if_last_article>
Looking at your page I think you have this code inside an article. Starting the first line of code with a space, or wrapping it in <notextile>
tags will prevent your archive list being wrapped in <p>
tags, which produces invalid html.
Offline
#7 2009-03-31 13:07:38
- K2member
- Member
- Registered: 2006-10-24
- Posts: 19
Re: Show list of months when section is active
Thank you, now it looks the way it’s supposed to :)
My archive list hasn’t been wrapped in <p>-tags, yet validome says the code isn’t valid: link
Last edited by K2member (2009-03-31 13:08:02)
Offline
#8 2009-03-31 14:00:00
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Show list of months when section is active
K2member wrote:
My archive list hasn’t been wrapped in <p>-tags,
Yes, it is:
<p>Hier findest du alle Einträge nach Datum sortiert:
<ul style="display:none;">
</ul>
<h2>March 2009</h2>
...etcetera
That’s because Textile wraps anything after a blank line in <p> tags. Place the code in the article like this:
notextile. <txp:if_first_article>
<ul style="display:none;">
</txp:if_first_article>
<txp:if_different>
</ul>
<h2><txp:posted format="%B %Y" /></h2>
<ul>
</txp:if_different>
<li><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article>
</ul>
</txp:if_last_article>
You can try it here and see what happens if you don’t add the notextile.
.
Offline
#9 2009-03-31 15:30:06
- K2member
- Member
- Registered: 2006-10-24
- Posts: 19
Re: Show list of months when section is active
Thanks! I must’ve overlooked it.
Offline