Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-10-15 18:31:52

dreamer
Member
Registered: 2007-06-08
Posts: 242

showing articles for a section, and monthly archives list

I tried looking through the FAQ as well as my own TXP Solutions book that I bought but couldn’t find the answers to these questions.

So here goes;

I want to show a list of articles in the sidebar. So if you are in Section A, then all articles of Section A will appear. I have the code below and it works, but when I click on any article on the sidebar and it takes me to that article, I will no longer see the other articles of that section in the sidebar.

<txp:if_section>
<ul>
<txp:article allowoverride="0" form="sidebarlist" limit="9" listform="sidebarlist" 
pgonly="0" searchall="0" searchsticky="0" sort="Posted desc" status="4" />
</ul>
<txp:else />
</txp:if_section>

I also want to;

  1. show the months that an article was written in on the sidebar too but don’t know how.
  2. and have a category appear for any blog entry.

For #2, I tried;

<txp:category link="1" title="1" this_section="1" />

or multiple variations of it, but nothing yet.

I looked at the explanation on the wiki for “ txp:category tag

but not sure what I’m missing.

Thanks.

Last edited by dreamer (2007-10-15 18:32:49)

Offline

#2 2007-10-16 19:36:10

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: showing articles for a section, and monthly archives list

Well, I figured out how to show the category with the <txp:category1 > tag.

I was trying to show the articles for a particular section by creating an if/else statement like this;

<txp:if_section name="sectionname1,anothersectionname">
<ul>
<txp:article form="sidebarlist" />
</ul>
</txp:if_section>

but that doesn’t seem to work. The articles still won’t show up on the sidebar. ???

Offline

#3 2007-10-16 21:47:53

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: showing articles for a section, and monthly archives list

dreamer wrote:

I want to show a list of articles in the sidebar. So if you are in Section A, then all articles of Section A will appear. I have the code below and it works, but when I click on any article on the sidebar and it takes me to that article, I will no longer see the other articles of that section in the sidebar.

That is because <txp:article /> is context sensitive, and so when in individual article mode will not display an article list. Try something like this:

<txp:if_individual_article>
   <txp:if_article_section name="sectionname1">
      <ul>
      <txp:article_custom section="sectionname1" form="sidebarlist" />
      </ul>
   </txp:if_article_section>
   <txp:if_article_section name="anothersectionname">
      <ul>
      <txp:article_custom section="anothersectionname" form="sidebarlist" />
      </ul>
   </txp:if_article_section>
<txp:else />
   <txp:if_section name="sectionname1,anothersectionname">
      <ul>
      <txp:article form="sidebarlist" />
      </ul>
   </txp:if_section>
</txp:if_individual_article>

show the months that an article was written in on the sidebar too but don’t know how

You can use txp:if_different.

Last edited by els (2007-10-16 21:50:58)

Offline

#4 2007-10-16 21:55:22

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: showing articles for a section, and monthly archives list

Actually, I’m using clean urls. My permanent link mode looks like this; /section/title

Offline

#5 2007-10-16 22:03:55

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: showing articles for a section, and monthly archives list

dreamer, I edited my post above (the part about the URLs wasn’t accurate, sorry about that).

Offline

Board footer

Powered by FluxBB